mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-21 21:32:58 +05:30
Updated texture example to iterate through all textures.
This commit is contained in:
parent
549105e536
commit
f34289def9
@ -209,19 +209,21 @@ Example Logic: Extract Pld's
|
||||
fw.write(chunk)
|
||||
i += 1
|
||||
|
||||
Example Logic: Extract Textures
|
||||
from ctypes import *
|
||||
Example Logic: Extract Textures from a Single Batch
|
||||
with open("pl01.pld_1.txp", "rb") as f:
|
||||
data = f.read()
|
||||
tx = pyTextureBatch(0, data)
|
||||
filename = "texture"
|
||||
i = 0
|
||||
bd = pyTextureBatchDescriptor(i, data)
|
||||
size = bd.gettexturesize()
|
||||
for texture in tx.gettextures():
|
||||
with open(filename + str(i) + ".dds", "wb") as fw:
|
||||
fw.write(texture)
|
||||
i += 1
|
||||
tp = pyTexturePack(data)
|
||||
filename = "texture" # part 1 of output file name
|
||||
id = 0 # part 2 of output file name
|
||||
# Iterate through all of the batches in the package.
|
||||
for i in range(0, tp.getbatchnumber()):
|
||||
# Get a batch.
|
||||
tx = pyTextureBatch(i, data)
|
||||
# Iterate through all textures in batch.
|
||||
for texture in tx.gettextures():
|
||||
with open(filename + str(id) + ".dds", "wb") as fw:
|
||||
fw.write(texture)
|
||||
id += 1
|
||||
|
||||
Example Logic: Iterate through all MeshHeaders and Meshes:
|
||||
with open("pl00.pld_0", "rb") as f:
|
||||
|
Loading…
Reference in New Issue
Block a user