mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-22 13:53:02 +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)
|
fw.write(chunk)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
Example Logic: Extract Textures
|
Example Logic: Extract Textures from a Single Batch
|
||||||
from ctypes import *
|
|
||||||
with open("pl01.pld_1.txp", "rb") as f:
|
with open("pl01.pld_1.txp", "rb") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
tx = pyTextureBatch(0, data)
|
tp = pyTexturePack(data)
|
||||||
filename = "texture"
|
filename = "texture" # part 1 of output file name
|
||||||
i = 0
|
id = 0 # part 2 of output file name
|
||||||
bd = pyTextureBatchDescriptor(i, data)
|
# Iterate through all of the batches in the package.
|
||||||
size = bd.gettexturesize()
|
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():
|
for texture in tx.gettextures():
|
||||||
with open(filename + str(i) + ".dds", "wb") as fw:
|
with open(filename + str(id) + ".dds", "wb") as fw:
|
||||||
fw.write(texture)
|
fw.write(texture)
|
||||||
i += 1
|
id += 1
|
||||||
|
|
||||||
Example Logic: Iterate through all MeshHeaders and Meshes:
|
Example Logic: Iterate through all MeshHeaders and Meshes:
|
||||||
with open("pl00.pld_0", "rb") as f:
|
with open("pl00.pld_0", "rb") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user