forked from LeenkxTeam/LNXSDK
Fix thinWall and passes
This commit is contained in:
@ -99,12 +99,12 @@ class ShaderContext:
|
||||
def sort_vs(self):
|
||||
vs = []
|
||||
ar = ['pos', 'nor', 'tex', 'tex1', 'morph', 'col', 'tang', 'bone', 'weight', 'ipos', 'irot', 'iscl']
|
||||
|
||||
|
||||
if 'vertex_elements' in self.data:
|
||||
for elem in self.data['vertex_elements']:
|
||||
if elem['name'] not in ar:
|
||||
ar.append(elem['name'])
|
||||
|
||||
|
||||
for ename in ar:
|
||||
elem = self.get_elem(ename)
|
||||
if elem != None:
|
||||
@ -137,6 +137,15 @@ class ShaderContext:
|
||||
if default_value is not None:
|
||||
if ctype == 'float':
|
||||
c['floatValue'] = default_value
|
||||
if isinstance(default_value, bool):
|
||||
c['floatValue'] = 1.0 if default_value else 0.0
|
||||
elif isinstance(default_value, (int, float)):
|
||||
c['floatValue'] = float(default_value)
|
||||
else:
|
||||
try:
|
||||
c['floatValue'] = float(default_value)
|
||||
except (ValueError, TypeError):
|
||||
c['floatValue'] = default_value
|
||||
if ctype == 'vec3':
|
||||
c['vec3Value'] = default_value
|
||||
if is_lnx_mat_param is not None:
|
||||
@ -418,11 +427,11 @@ class Shader:
|
||||
def validate(self):
|
||||
import re
|
||||
issues = []
|
||||
|
||||
|
||||
# Check for duplicate variable declarations in main_attribs
|
||||
var_pattern = re.compile(r'\b(vec[234]|float|int|mat[234])\s+(\w+)\s*[;=]')
|
||||
declared_vars = {}
|
||||
|
||||
|
||||
for line in self.main_attribs.split('\n'):
|
||||
match = var_pattern.search(line)
|
||||
if match:
|
||||
@ -431,7 +440,7 @@ class Shader:
|
||||
issues.append(f"Duplicate variable declaration: '{var_name}' (type: {var_type})")
|
||||
else:
|
||||
declared_vars[var_name] = var_type
|
||||
|
||||
|
||||
return issues
|
||||
|
||||
def get(self):
|
||||
|
||||
Reference in New Issue
Block a user