Skip to content

Commit

Permalink
Merge pull request #2928 from QuantumCoderQC/HL-compile-fix
Browse files Browse the repository at this point in the history
Change bind and shader constants names
  • Loading branch information
luboslenco authored Sep 18, 2023
2 parents 09c69da + a6cc650 commit 0f1b9ae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Sources/armory/trait/internal/UniformsManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ class UniformsManager extends Trait{
switch (constant.type) {
case "float":
var link = constant.link;
var value = constant.float;
var value = constant.floatValue;
setFloatValue(material, object, link, value);
register(Float);

case "vec3":
var vec = new Vec4();
vec.x = constant.vec3.get(0);
vec.y = constant.vec3.get(1);
vec.z = constant.vec3.get(2);
vec.x = constant.vec3Value.get(0);
vec.y = constant.vec3Value.get(1);
vec.z = constant.vec3Value.get(2);

setVec3Value(material, object, constant.link, vec);
register(Vector);
Expand Down
12 changes: 6 additions & 6 deletions blender/arm/material/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,21 @@ def parse(material: Material, mat_data, mat_users: Dict[Material, List[Object]],
mat_data['contexts'].append(c)

if rp == 'mesh':
c['bind_constants'].append({'name': 'receiveShadow', 'bool': material.arm_receive_shadow})
c['bind_constants'].append({'name': 'receiveShadow', 'boolValue': material.arm_receive_shadow})

if material.arm_material_id != 0:
c['bind_constants'].append({'name': 'materialID', 'int': material.arm_material_id})
c['bind_constants'].append({'name': 'materialID', 'intValue': material.arm_material_id})

if material.arm_material_id == 2:
wrd.world_defs += '_Hair'

elif rpdat.rp_sss_state != 'Off':
const = {'name': 'materialID'}
if needs_sss:
const['int'] = 2
const['intValue'] = 2
sss_used = True
else:
const['int'] = 0
const['intValue'] = 0
c['bind_constants'].append(const)

# TODO: Mesh only material batching
Expand All @@ -133,10 +133,10 @@ def parse(material: Material, mat_data, mat_users: Dict[Material, List[Object]],
for inp in node.inputs:
if inp.is_uniform:
uname = arm.utils.safesrc(inp.node.name) + arm.utils.safesrc(inp.name) # Merge with cycles module
c['bind_constants'].append({'name': uname, cycles.glsl_type(inp.type): glsl_value(inp.default_value)})
c['bind_constants'].append({'name': uname, cycles.glsl_type(inp.type)+'Value': glsl_value(inp.default_value)})

elif rp == 'translucent':
c['bind_constants'].append({'name': 'receiveShadow', 'bool': material.arm_receive_shadow})
c['bind_constants'].append({'name': 'receiveShadow', 'boolValue': material.arm_receive_shadow})

elif rp == 'shadowmap':
if wrd.arm_batch_materials:
Expand Down
4 changes: 2 additions & 2 deletions blender/arm/material/shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ def add_constant(self, ctype, name, link=None, default_value=None, is_arm_mat_pa
c['link'] = link
if default_value is not None:
if ctype == 'float':
c['float'] = default_value
c['floatValue'] = default_value
if ctype == 'vec3':
c['vec3'] = default_value
c['vec3Value'] = default_value
if is_arm_mat_param is not None:
c['is_arm_parameter'] = True
self.constants.append(c)
Expand Down

0 comments on commit 0f1b9ae

Please sign in to comment.