store cooked models by id, meta. remove face from quad tuples
This commit is contained in:
parent
d997a44264
commit
c23cad678b
@ -47,6 +47,7 @@ class BlockModels(object):
|
||||
self._textureNames = set()
|
||||
self.firstTextures = {} # first texture found for each block - used for icons (xxx)
|
||||
self.cookedModels = {} # nameAndState -> [face -> xyzuv, cullface]
|
||||
self.cookedModelsByID = {} # (id, meta) -> [face -> xyzuv, cullface]
|
||||
|
||||
for i, block in enumerate(blocktypes):
|
||||
if i % 100 == 0:
|
||||
@ -209,6 +210,7 @@ class BlockModels(object):
|
||||
|
||||
def cookQuads(self, textureAtlas):
|
||||
cookedModels = {}
|
||||
cookedModelsByID = {}
|
||||
for nameAndState, allQuads in self.modelQuads.iteritems():
|
||||
cookedQuads = []
|
||||
for (box, face, texture, uv, cullface, shade, rotation, textureRotation,
|
||||
@ -252,11 +254,14 @@ class BlockModels(object):
|
||||
else:
|
||||
xyzuvc.view('uint8')[:, 20:] = 0xff
|
||||
|
||||
cookedQuads.append((face, xyzuvc, cullface))
|
||||
cookedQuads.append((xyzuvc, cullface))
|
||||
|
||||
cookedModels[nameAndState] = cookedQuads
|
||||
ID, meta = self.blocktypes.IDsByState[nameAndState]
|
||||
cookedModelsByID[ID, meta] = cookedQuads
|
||||
|
||||
self.cookedModels = cookedModels
|
||||
self.cookedModelsByID = cookedModelsByID
|
||||
|
||||
def rotateVertices(self, rotation, variantXrot, variantYrot, variantZrot, xyzuvc):
|
||||
if rotation is not None:
|
||||
|
@ -17,7 +17,7 @@ class BlockModelMesh(object):
|
||||
"""
|
||||
|
||||
:param sectionUpdate:
|
||||
:type sectionUpdate: SectionUpdate
|
||||
:type sectionUpdate: mcedit2.rendering.chunkupdate.SectionUpdate
|
||||
:return:
|
||||
:rtype:
|
||||
"""
|
||||
@ -52,10 +52,11 @@ class BlockModelMesh(object):
|
||||
block = blocktypes[ID, meta]
|
||||
if block.renderType != 3: # only model blocks for now
|
||||
continue
|
||||
nameAndState = block.internalName + block.blockState
|
||||
quads = blockModels.cookedModels[nameAndState]
|
||||
quads = blockModels.cookedModelsByID.get((ID, meta))
|
||||
if quads is None:
|
||||
continue
|
||||
|
||||
for face, xyzuvc, cullface in quads:
|
||||
for xyzuvc, cullface in quads:
|
||||
if cullface is not None:
|
||||
dx, dy, dz = cullface.vector
|
||||
nx = x + dx
|
||||
|
Reference in New Issue
Block a user