mirror of
https://github.com/ApfelTeeSaft/lightspeed64.git
synced 2026-08-26 19:33:24 +00:00
Optimized flat shaded model processing on export. Fixed issue with shadow geolayout node importing.
This commit is contained in:
@@ -300,16 +300,10 @@ def edgeValid(edgeValidDict, face, otherFace):
|
||||
else:
|
||||
return edgeValidDict[(otherFace, face)]
|
||||
|
||||
def getLowestUnvisitedNeighborCountFace(faces, visitedFaces, infoDict):
|
||||
lowestNeighborFace = None
|
||||
for face in faces:
|
||||
if face not in visitedFaces:
|
||||
lowestNeighborFace = face
|
||||
break
|
||||
def getLowestUnvisitedNeighborCountFace(unvisitedFaces, infoDict):
|
||||
lowestNeighborFace = unvisitedFaces[0]
|
||||
lowestNeighborCount = len(infoDict['validNeighbors'][lowestNeighborFace])
|
||||
for face in faces:
|
||||
if face in visitedFaces:
|
||||
continue
|
||||
for face in unvisitedFaces:
|
||||
neighborCount = len(infoDict['validNeighbors'][face])
|
||||
if neighborCount < lowestNeighborCount:
|
||||
lowestNeighborFace = face
|
||||
@@ -351,10 +345,10 @@ def saveTriangleStrip(faces, convertInfo, triList, vtxList, f3d,
|
||||
texDimensions, transformMatrix, isPointSampled, exportVertexColors,
|
||||
existingVertexData, existingVertexMaterialRegions, infoDict, mesh):
|
||||
visitedFaces = []
|
||||
unvisitedFaces = copy.copy(faces)
|
||||
possibleFaces = []
|
||||
lastEdgeKey = None
|
||||
neighborFace = getLowestUnvisitedNeighborCountFace(
|
||||
faces, visitedFaces, infoDict)
|
||||
neighborFace = getLowestUnvisitedNeighborCountFace(unvisitedFaces, infoDict)
|
||||
|
||||
triConverter = TriangleConverter(mesh, convertInfo, triList, vtxList, f3d,
|
||||
texDimensions, transformMatrix, isPointSampled, exportVertexColors,
|
||||
@@ -371,13 +365,14 @@ def saveTriangleStrip(faces, convertInfo, triList, vtxList, f3d,
|
||||
else:
|
||||
#print('get new neighbor')
|
||||
neighborFace = getLowestUnvisitedNeighborCountFace(
|
||||
faces, visitedFaces, infoDict)
|
||||
unvisitedFaces, infoDict)
|
||||
lastEdgeKey = None
|
||||
|
||||
triConverter.addFace(neighborFace)
|
||||
if neighborFace in visitedFaces:
|
||||
raise ValueError("Repeated face")
|
||||
visitedFaces.append(neighborFace)
|
||||
unvisitedFaces.remove(neighborFace)
|
||||
if neighborFace in possibleFaces:
|
||||
possibleFaces.remove(neighborFace)
|
||||
for otherFace in infoDict['validNeighbors'][neighborFace]:
|
||||
|
||||
@@ -54,6 +54,8 @@ enumShadowType = [
|
||||
('10', 'Square Permanent', 'Square Permanent'),
|
||||
('11', 'Square Scalable', 'Square Scalable'),
|
||||
('12', 'Square Togglable', 'Square Togglable'),
|
||||
('50', 'Rectangle', 'Rectangle'),
|
||||
('99', 'Circle Player', 'Circle Player'),
|
||||
]
|
||||
|
||||
enumSwitchOptions = [
|
||||
|
||||
@@ -6,6 +6,7 @@ import copy
|
||||
from math import pi
|
||||
|
||||
from .sm64_level_parser import *
|
||||
from .sm64_geolayout_bone import enumShadowType
|
||||
from .sm64_geolayout_constants import *
|
||||
from .sm64_geolayout_utility import *
|
||||
from .f3d_parser import *
|
||||
@@ -929,6 +930,13 @@ def parseShadow(romfile, currentAddress, currentTransform,
|
||||
romfile.seek(currentAddress)
|
||||
command = romfile.read(commandSize)
|
||||
shadowType = int.from_bytes(command[2:4], 'big')
|
||||
if str(shadowType) not in enumShadowType:
|
||||
if shadowType > 12 and shadowType < 50: # Square Shadow
|
||||
shadowType = 12
|
||||
elif shadowType > 50 and shadowType < 99: # Rectangle Shadow
|
||||
shadowType = 50
|
||||
else: # Invalid shadow
|
||||
shadowType = 0
|
||||
shadowSolidity = int.from_bytes(command[4:6], 'big')
|
||||
shadowScale = int.from_bytes(command[6:8], 'big')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user