collada_scene: render materials

This commit is contained in:
Zack Buhman 2026-01-26 20:46:54 -06:00
parent b8cea38d9f
commit 802136c03c
6 changed files with 1229 additions and 829 deletions

View File

@ -6,8 +6,8 @@
<authoring_tool>OpenCOLLADA for 3ds Max; Version: 1.6; Revision: 68</authoring_tool> <authoring_tool>OpenCOLLADA for 3ds Max; Version: 1.6; Revision: 68</authoring_tool>
<source_data>file:///C:/cygwin/home/bilbo/d3d10/models/curve_interpolation/curve_interpolation.max</source_data> <source_data>file:///C:/cygwin/home/bilbo/d3d10/models/curve_interpolation/curve_interpolation.max</source_data>
</contributor> </contributor>
<created>2026-01-25T13:40:01</created> <created>2026-01-26T20:45:12</created>
<modified>2026-01-25T13:40:01</modified> <modified>2026-01-26T20:45:12</modified>
<unit name="inch" meter="0.0254"/> <unit name="inch" meter="0.0254"/>
<up_axis>Z_UP</up_axis> <up_axis>Z_UP</up_axis>
</asset> </asset>
@ -622,15 +622,15 @@
<instance_light url="#EnvironmentAmbientLight"/> <instance_light url="#EnvironmentAmbientLight"/>
</node> </node>
<node id="node-Cube" name="Cube"> <node id="node-Cube" name="Cube">
<translate sid="translation">10 0 0</translate> <translate sid="translation">10 -1.14258e-7 0</translate>
<instance_geometry url="#geom-Cube"> <instance_geometry url="#geom-Cube">
<bind_material> <bind_material>
<technique_common> <technique_common>
<instance_material symbol="Material__15_1" target="#Material__15-material"/> <instance_material symbol="Material__15_1" target="#Material__15-material"/>
<instance_material symbol="Material__16_1" target="#Material__16-material"/>
<instance_material symbol="Material__17_1" target="#Material__17-material"/> <instance_material symbol="Material__17_1" target="#Material__17-material"/>
<instance_material symbol="Material__18_1" target="#Material__18-material"/> <instance_material symbol="Material__18_1" target="#Material__18-material"/>
<instance_material symbol="Material__19_1" target="#Material__19-material"/> <instance_material symbol="Material__19_1" target="#Material__19-material"/>
<instance_material symbol="Material__16_1" target="#Material__16-material"/>
<instance_material symbol="Material__20_1" target="#Material__20-material"/> <instance_material symbol="Material__20_1" target="#Material__20-material"/>
</technique_common> </technique_common>
</bind_material> </bind_material>

View File

@ -6,24 +6,27 @@
<authoring_tool>OpenCOLLADA for 3ds Max; Version: 1.6; Revision: 68</authoring_tool> <authoring_tool>OpenCOLLADA for 3ds Max; Version: 1.6; Revision: 68</authoring_tool>
<source_data>file:///C:/cygwin/home/bilbo/d3d10/models/skinned_cube/skinned_cube.max</source_data> <source_data>file:///C:/cygwin/home/bilbo/d3d10/models/skinned_cube/skinned_cube.max</source_data>
</contributor> </contributor>
<created>2026-01-24T13:01:29</created> <created>2026-01-25T14:06:19</created>
<modified>2026-01-24T13:01:29</modified> <modified>2026-01-25T14:06:19</modified>
<unit name="inch" meter="0.0254"/> <unit name="inch" meter="0.0254"/>
<up_axis>Z_UP</up_axis> <up_axis>Z_UP</up_axis>
</asset> </asset>
<library_effects> <library_effects>
<effect id="ColorEffectR26G177B26"> <effect id="Material__13">
<profile_COMMON> <profile_COMMON>
<technique sid="common"> <technique sid="common">
<phong> <blinn>
<emission>
<color>0 0 0 1</color>
</emission>
<ambient> <ambient>
<color>0.1019608 0.6941176 0.1019608 1</color> <color>0.5882353 0.5882353 1 1</color>
</ambient> </ambient>
<diffuse> <diffuse>
<color>0.1019608 0.6941176 0.1019608 1</color> <color>0.5882353 0.5882353 1 1</color>
</diffuse> </diffuse>
<specular> <specular>
<color>1 1 1 1</color> <color>0 0 0 1</color>
</specular> </specular>
<shininess> <shininess>
<float>10</float> <float>10</float>
@ -31,20 +34,339 @@
<reflective> <reflective>
<color>0 0 0 1</color> <color>0 0 0 1</color>
</reflective> </reflective>
<transparent> <transparent opaque="A_ONE">
<color>1 1 1 1</color> <color>1 1 1 1</color>
</transparent> </transparent>
<transparency> <transparency>
<float>1</float> <float>1</float>
</transparency> </transparency>
</phong> </blinn>
</technique> </technique>
</profile_COMMON> </profile_COMMON>
<extra>
<technique profile="OpenCOLLADA3dsMax">
<extended_shader>
<opacity_type sid="opacity_type" type="int">0</opacity_type>
<falloff_type sid="falloff_type" type="int">0</falloff_type>
<falloff sid="falloff" type="float">0</falloff>
<index_of_refraction sid="index_of_refraction" type="float">1.5</index_of_refraction>
<wire_size sid="wire_size" type="float">1</wire_size>
<wire_units sid="wire_units" type="int">0</wire_units>
<apply_reflection_dimming sid="apply_reflection_dimming" type="bool">0</apply_reflection_dimming>
<dim_level sid="dim_level" type="float">0</dim_level>
<reflection_level sid="reflection_level" type="float">3</reflection_level>
</extended_shader>
<shader>
<ambient_diffuse_texture_lock sid="ambient_diffuse_texture_lock" type="bool">1</ambient_diffuse_texture_lock>
<ambient_diffuse_lock sid="ambient_diffuse_lock" type="bool">1</ambient_diffuse_lock>
<diffuse_specular_lock sid="diffuse_specular_lock" type="bool">0</diffuse_specular_lock>
<use_self_illum_color sid="use_self_illum_color" type="bool">0</use_self_illum_color>
<self_illumination sid="self_illumination" type="float">0</self_illumination>
<specular_level sid="specular_level" type="float">0</specular_level>
<soften sid="soften" type="float">0.1</soften>
</shader>
</technique>
</extra>
</effect>
<effect id="Material__14">
<profile_COMMON>
<technique sid="common">
<blinn>
<emission>
<color>0 0 0 1</color>
</emission>
<ambient>
<color>0.5882353 0.9450981 1 1</color>
</ambient>
<diffuse>
<color>0.5882353 0.9450981 1 1</color>
</diffuse>
<specular>
<color>0 0 0 1</color>
</specular>
<shininess>
<float>10</float>
</shininess>
<reflective>
<color>0 0 0 1</color>
</reflective>
<transparent opaque="A_ONE">
<color>1 1 1 1</color>
</transparent>
<transparency>
<float>1</float>
</transparency>
</blinn>
</technique>
</profile_COMMON>
<extra>
<technique profile="OpenCOLLADA3dsMax">
<extended_shader>
<opacity_type sid="opacity_type" type="int">0</opacity_type>
<falloff_type sid="falloff_type" type="int">0</falloff_type>
<falloff sid="falloff" type="float">0</falloff>
<index_of_refraction sid="index_of_refraction" type="float">1.5</index_of_refraction>
<wire_size sid="wire_size" type="float">1</wire_size>
<wire_units sid="wire_units" type="int">0</wire_units>
<apply_reflection_dimming sid="apply_reflection_dimming" type="bool">0</apply_reflection_dimming>
<dim_level sid="dim_level" type="float">0</dim_level>
<reflection_level sid="reflection_level" type="float">3</reflection_level>
</extended_shader>
<shader>
<ambient_diffuse_texture_lock sid="ambient_diffuse_texture_lock" type="bool">1</ambient_diffuse_texture_lock>
<ambient_diffuse_lock sid="ambient_diffuse_lock" type="bool">1</ambient_diffuse_lock>
<diffuse_specular_lock sid="diffuse_specular_lock" type="bool">0</diffuse_specular_lock>
<use_self_illum_color sid="use_self_illum_color" type="bool">0</use_self_illum_color>
<self_illumination sid="self_illumination" type="float">0</self_illumination>
<specular_level sid="specular_level" type="float">0</specular_level>
<soften sid="soften" type="float">0.1</soften>
</shader>
</technique>
</extra>
</effect>
<effect id="Material__15">
<profile_COMMON>
<technique sid="common">
<blinn>
<emission>
<color>0 0 0 1</color>
</emission>
<ambient>
<color>0.5882353 1 0.6156863 1</color>
</ambient>
<diffuse>
<color>0.5882353 1 0.6156863 1</color>
</diffuse>
<specular>
<color>0 0 0 1</color>
</specular>
<shininess>
<float>10</float>
</shininess>
<reflective>
<color>0 0 0 1</color>
</reflective>
<transparent opaque="A_ONE">
<color>1 1 1 1</color>
</transparent>
<transparency>
<float>1</float>
</transparency>
</blinn>
</technique>
</profile_COMMON>
<extra>
<technique profile="OpenCOLLADA3dsMax">
<extended_shader>
<opacity_type sid="opacity_type" type="int">0</opacity_type>
<falloff_type sid="falloff_type" type="int">0</falloff_type>
<falloff sid="falloff" type="float">0</falloff>
<index_of_refraction sid="index_of_refraction" type="float">1.5</index_of_refraction>
<wire_size sid="wire_size" type="float">1</wire_size>
<wire_units sid="wire_units" type="int">0</wire_units>
<apply_reflection_dimming sid="apply_reflection_dimming" type="bool">0</apply_reflection_dimming>
<dim_level sid="dim_level" type="float">0</dim_level>
<reflection_level sid="reflection_level" type="float">3</reflection_level>
</extended_shader>
<shader>
<ambient_diffuse_texture_lock sid="ambient_diffuse_texture_lock" type="bool">1</ambient_diffuse_texture_lock>
<ambient_diffuse_lock sid="ambient_diffuse_lock" type="bool">1</ambient_diffuse_lock>
<diffuse_specular_lock sid="diffuse_specular_lock" type="bool">0</diffuse_specular_lock>
<use_self_illum_color sid="use_self_illum_color" type="bool">0</use_self_illum_color>
<self_illumination sid="self_illumination" type="float">0</self_illumination>
<specular_level sid="specular_level" type="float">0</specular_level>
<soften sid="soften" type="float">0.1</soften>
</shader>
</technique>
</extra>
</effect>
<effect id="Material__16">
<profile_COMMON>
<technique sid="common">
<blinn>
<emission>
<color>0 0 0 1</color>
</emission>
<ambient>
<color>0.9960785 1 0.5882353 1</color>
</ambient>
<diffuse>
<color>0.9960785 1 0.5882353 1</color>
</diffuse>
<specular>
<color>0 0 0 1</color>
</specular>
<shininess>
<float>10</float>
</shininess>
<reflective>
<color>0 0 0 1</color>
</reflective>
<transparent opaque="A_ONE">
<color>1 1 1 1</color>
</transparent>
<transparency>
<float>1</float>
</transparency>
</blinn>
</technique>
</profile_COMMON>
<extra>
<technique profile="OpenCOLLADA3dsMax">
<extended_shader>
<opacity_type sid="opacity_type" type="int">0</opacity_type>
<falloff_type sid="falloff_type" type="int">0</falloff_type>
<falloff sid="falloff" type="float">0</falloff>
<index_of_refraction sid="index_of_refraction" type="float">1.5</index_of_refraction>
<wire_size sid="wire_size" type="float">1</wire_size>
<wire_units sid="wire_units" type="int">0</wire_units>
<apply_reflection_dimming sid="apply_reflection_dimming" type="bool">0</apply_reflection_dimming>
<dim_level sid="dim_level" type="float">0</dim_level>
<reflection_level sid="reflection_level" type="float">3</reflection_level>
</extended_shader>
<shader>
<ambient_diffuse_texture_lock sid="ambient_diffuse_texture_lock" type="bool">1</ambient_diffuse_texture_lock>
<ambient_diffuse_lock sid="ambient_diffuse_lock" type="bool">1</ambient_diffuse_lock>
<diffuse_specular_lock sid="diffuse_specular_lock" type="bool">0</diffuse_specular_lock>
<use_self_illum_color sid="use_self_illum_color" type="bool">0</use_self_illum_color>
<self_illumination sid="self_illumination" type="float">0</self_illumination>
<specular_level sid="specular_level" type="float">0</specular_level>
<soften sid="soften" type="float">0.1</soften>
</shader>
</technique>
</extra>
</effect>
<effect id="Material__17">
<profile_COMMON>
<technique sid="common">
<blinn>
<emission>
<color>0 0 0 1</color>
</emission>
<ambient>
<color>0.9960785 0.8196079 0.5882353 1</color>
</ambient>
<diffuse>
<color>0.9960785 0.8196079 0.5882353 1</color>
</diffuse>
<specular>
<color>0 0 0 1</color>
</specular>
<shininess>
<float>10</float>
</shininess>
<reflective>
<color>0 0 0 1</color>
</reflective>
<transparent opaque="A_ONE">
<color>1 1 1 1</color>
</transparent>
<transparency>
<float>1</float>
</transparency>
</blinn>
</technique>
</profile_COMMON>
<extra>
<technique profile="OpenCOLLADA3dsMax">
<extended_shader>
<opacity_type sid="opacity_type" type="int">0</opacity_type>
<falloff_type sid="falloff_type" type="int">0</falloff_type>
<falloff sid="falloff" type="float">0</falloff>
<index_of_refraction sid="index_of_refraction" type="float">1.5</index_of_refraction>
<wire_size sid="wire_size" type="float">1</wire_size>
<wire_units sid="wire_units" type="int">0</wire_units>
<apply_reflection_dimming sid="apply_reflection_dimming" type="bool">0</apply_reflection_dimming>
<dim_level sid="dim_level" type="float">0</dim_level>
<reflection_level sid="reflection_level" type="float">3</reflection_level>
</extended_shader>
<shader>
<ambient_diffuse_texture_lock sid="ambient_diffuse_texture_lock" type="bool">1</ambient_diffuse_texture_lock>
<ambient_diffuse_lock sid="ambient_diffuse_lock" type="bool">1</ambient_diffuse_lock>
<diffuse_specular_lock sid="diffuse_specular_lock" type="bool">0</diffuse_specular_lock>
<use_self_illum_color sid="use_self_illum_color" type="bool">0</use_self_illum_color>
<self_illumination sid="self_illumination" type="float">0</self_illumination>
<specular_level sid="specular_level" type="float">0</specular_level>
<soften sid="soften" type="float">0.1</soften>
</shader>
</technique>
</extra>
</effect>
<effect id="Material__18">
<profile_COMMON>
<technique sid="common">
<blinn>
<emission>
<color>0 0 0 1</color>
</emission>
<ambient>
<color>1 0.5882353 0.5882353 1</color>
</ambient>
<diffuse>
<color>1 0.5882353 0.5882353 1</color>
</diffuse>
<specular>
<color>0 0 0 1</color>
</specular>
<shininess>
<float>10</float>
</shininess>
<reflective>
<color>0 0 0 1</color>
</reflective>
<transparent opaque="A_ONE">
<color>1 1 1 1</color>
</transparent>
<transparency>
<float>1</float>
</transparency>
</blinn>
</technique>
</profile_COMMON>
<extra>
<technique profile="OpenCOLLADA3dsMax">
<extended_shader>
<opacity_type sid="opacity_type" type="int">0</opacity_type>
<falloff_type sid="falloff_type" type="int">0</falloff_type>
<falloff sid="falloff" type="float">0</falloff>
<index_of_refraction sid="index_of_refraction" type="float">1.5</index_of_refraction>
<wire_size sid="wire_size" type="float">1</wire_size>
<wire_units sid="wire_units" type="int">0</wire_units>
<apply_reflection_dimming sid="apply_reflection_dimming" type="bool">0</apply_reflection_dimming>
<dim_level sid="dim_level" type="float">0</dim_level>
<reflection_level sid="reflection_level" type="float">3</reflection_level>
</extended_shader>
<shader>
<ambient_diffuse_texture_lock sid="ambient_diffuse_texture_lock" type="bool">1</ambient_diffuse_texture_lock>
<ambient_diffuse_lock sid="ambient_diffuse_lock" type="bool">1</ambient_diffuse_lock>
<diffuse_specular_lock sid="diffuse_specular_lock" type="bool">0</diffuse_specular_lock>
<use_self_illum_color sid="use_self_illum_color" type="bool">0</use_self_illum_color>
<self_illumination sid="self_illumination" type="float">0</self_illumination>
<specular_level sid="specular_level" type="float">0</specular_level>
<soften sid="soften" type="float">0.1</soften>
</shader>
</technique>
</extra>
</effect> </effect>
</library_effects> </library_effects>
<library_materials> <library_materials>
<material id="ColorEffectR26G177B26-material" name="ColorEffectR26G177B26-material"> <material id="Material__13-material" name="Material__13">
<instance_effect url="#ColorEffectR26G177B26"/> <instance_effect url="#Material__13"/>
</material>
<material id="Material__14-material" name="Material__14">
<instance_effect url="#Material__14"/>
</material>
<material id="Material__15-material" name="Material__15">
<instance_effect url="#Material__15"/>
</material>
<material id="Material__16-material" name="Material__16">
<instance_effect url="#Material__16"/>
</material>
<material id="Material__17-material" name="Material__17">
<instance_effect url="#Material__17"/>
</material>
<material id="Material__18-material" name="Material__18">
<instance_effect url="#Material__18"/>
</material> </material>
</library_materials> </library_materials>
<library_geometries> <library_geometries>
@ -71,9 +393,9 @@
</technique_common> </technique_common>
</source> </source>
<source id="geom-Box001-map1"> <source id="geom-Box001-map1">
<float_array id="geom-Box001-map1-array" count="84">0 0 0 1 0 0 0 0.2 0 1 0.2 0 0 0.4 0 1 0.4 0 0 0.6 0 1 0.6 0 0 0.8 0 1 0.8 0 0 1 0 1 1 0 0 0 0 1 0 0 0 0.2 0 1 0.2 0 0 0.4 0 1 0.4 0 0 0.6 0 1 0.6 0 0 0.8 0 1 0.8 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0</float_array> <float_array id="geom-Box001-map1-array" count="168">1 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 0.2 0 1 0.2 0 0 0.4 0 1 0.4 0 0 0.6 0 1 0.6 0 0 0.8 0 1 0.8 0 0 1 0 1 1 0 0 0 0 1 0 0 0 0.2 0 1 0.2 0 0 0.4 0 1 0.4 0 0 0.6 0 1 0.6 0 0 0.8 0 1 0.8 0 0 1 0 1 1 0 0 0 0 1 0 0 0 0.2 0 1 0.2 0 0 0.4 0 1 0.4 0 0 0.6 0 1 0.6 0 0 0.8 0 1 0.8 0 0 1 0 1 1 0 0 0 0 1 0 0 0 0.2 0 1 0.2 0 0 0.4 0 1 0.4 0 0 0.6 0 1 0.6 0 0 0.8 0 1 0.8 0 0 1 0 1 1 0</float_array>
<technique_common> <technique_common>
<accessor source="#geom-Box001-map1-array" count="28" stride="3"> <accessor source="#geom-Box001-map1-array" count="56" stride="3">
<param name="S" type="float"/> <param name="S" type="float"/>
<param name="T" type="float"/> <param name="T" type="float"/>
<param name="P" type="float"/> <param name="P" type="float"/>
@ -83,26 +405,43 @@
<vertices id="geom-Box001-vertices"> <vertices id="geom-Box001-vertices">
<input semantic="POSITION" source="#geom-Box001-positions"/> <input semantic="POSITION" source="#geom-Box001-positions"/>
</vertices> </vertices>
<triangles material="ColorMaterial" count="44"> <triangles material="Material__14_1" count="2">
<input semantic="VERTEX" source="#geom-Box001-vertices" offset="0"/> <input semantic="VERTEX" source="#geom-Box001-vertices" offset="0"/>
<input semantic="NORMAL" source="#geom-Box001-normals" offset="1"/> <input semantic="NORMAL" source="#geom-Box001-normals" offset="1"/>
<input semantic="TEXCOORD" source="#geom-Box001-map1" offset="2" set="0"/> <input semantic="TEXCOORD" source="#geom-Box001-map1" offset="2" set="0"/>
<p>0 0 25 2 1 27 3 2 26 3 2 26 1 3 24 0 0 25 4 4 24 5 5 25 7 6 27 7 6 27 6 7 26 4 4 24 0 8 12 1 9 13 9 10 15 9 10 15 8 11 14 0 8 12 8 11 14 9 10 15 13 12 17 13 12 17 12 13 16 8 11 14 12 13 16 13 12 17 17 14 19 17 14 19 16 15 18 12 13 16 16 15 18 17 14 19 21 16 21 21 16 21 20 17 20 16 15 18 20 17 20 21 16 21 5 18 23 5 18 23 4 19 22 20 17 20 1 20 0 3 21 1 10 22 3 10 22 3 9 23 2 1 20 0 9 23 2 10 22 3 14 24 5 14 24 5 13 25 4 9 23 2 13 25 4 14 24 5 18 26 7 18 26 7 17 27 6 13 25 4 17 27 6 18 26 7 22 28 9 22 28 9 21 29 8 17 27 6 21 29 8 22 28 9 7 30 11 7 30 11 5 31 10 21 29 8 3 32 12 2 33 13 11 34 15 11 34 15 10 35 14 3 32 12 10 35 14 11 34 15 15 36 17 15 36 17 14 37 16 10 35 14 14 37 16 15 36 17 19 38 19 19 38 19 18 39 18 14 37 16 18 39 18 19 38 19 23 40 21 23 40 21 22 41 20 18 39 18 22 41 20 23 40 21 6 42 23 6 42 23 7 43 22 22 41 20 2 44 0 0 45 1 8 46 3 8 46 3 11 47 2 2 44 0 11 47 2 8 46 3 12 48 5 12 48 5 15 49 4 11 47 2 15 49 4 12 48 5 16 50 7 16 50 7 19 51 6 15 49 4 19 51 6 16 50 7 20 52 9 20 52 9 23 53 8 19 51 6 23 53 8 20 52 9 4 54 11 4 54 11 6 55 10 23 53 8</p> <p>0 0 0 2 1 2 3 2 3 3 2 3 1 3 1 0 0 0</p>
</triangles>
<triangles material="Material__13_1" count="2">
<input semantic="VERTEX" source="#geom-Box001-vertices" offset="0"/>
<input semantic="NORMAL" source="#geom-Box001-normals" offset="1"/>
<input semantic="TEXCOORD" source="#geom-Box001-map1" offset="2" set="0"/>
<p>4 4 4 5 5 5 7 6 7 7 6 7 6 7 6 4 4 4</p>
</triangles>
<triangles material="Material__17_1" count="10">
<input semantic="VERTEX" source="#geom-Box001-vertices" offset="0"/>
<input semantic="NORMAL" source="#geom-Box001-normals" offset="1"/>
<input semantic="TEXCOORD" source="#geom-Box001-map1" offset="2" set="0"/>
<p>0 8 8 1 9 9 9 10 11 9 10 11 8 11 10 0 8 8 8 11 10 9 10 11 13 12 13 13 12 13 12 13 12 8 11 10 12 13 12 13 12 13 17 14 15 17 14 15 16 15 14 12 13 12 16 15 14 17 14 15 21 16 17 21 16 17 20 17 16 16 15 14 20 17 16 21 16 17 5 18 19 5 18 19 4 19 18 20 17 16</p>
</triangles>
<triangles material="Material__16_1" count="10">
<input semantic="VERTEX" source="#geom-Box001-vertices" offset="0"/>
<input semantic="NORMAL" source="#geom-Box001-normals" offset="1"/>
<input semantic="TEXCOORD" source="#geom-Box001-map1" offset="2" set="0"/>
<p>1 20 20 3 21 21 10 22 23 10 22 23 9 23 22 1 20 20 9 23 22 10 22 23 14 24 25 14 24 25 13 25 24 9 23 22 13 25 24 14 24 25 18 26 27 18 26 27 17 27 26 13 25 24 17 27 26 18 26 27 22 28 29 22 28 29 21 29 28 17 27 26 21 29 28 22 28 29 7 30 31 7 30 31 5 31 30 21 29 28</p>
</triangles>
<triangles material="Material__18_1" count="10">
<input semantic="VERTEX" source="#geom-Box001-vertices" offset="0"/>
<input semantic="NORMAL" source="#geom-Box001-normals" offset="1"/>
<input semantic="TEXCOORD" source="#geom-Box001-map1" offset="2" set="0"/>
<p>3 32 32 2 33 33 11 34 35 11 34 35 10 35 34 3 32 32 10 35 34 11 34 35 15 36 37 15 36 37 14 37 36 10 35 34 14 37 36 15 36 37 19 38 39 19 38 39 18 39 38 14 37 36 18 39 38 19 38 39 23 40 41 23 40 41 22 41 40 18 39 38 22 41 40 23 40 41 6 42 43 6 42 43 7 43 42 22 41 40</p>
</triangles>
<triangles material="Material__15_1" count="10">
<input semantic="VERTEX" source="#geom-Box001-vertices" offset="0"/>
<input semantic="NORMAL" source="#geom-Box001-normals" offset="1"/>
<input semantic="TEXCOORD" source="#geom-Box001-map1" offset="2" set="0"/>
<p>2 44 44 0 45 45 8 46 47 8 46 47 11 47 46 2 44 44 11 47 46 8 46 47 12 48 49 12 48 49 15 49 48 11 47 46 15 49 48 12 48 49 16 50 51 16 50 51 19 51 50 15 49 48 19 51 50 16 50 51 20 52 53 20 52 53 23 53 52 19 51 50 23 53 52 20 52 53 4 54 55 4 54 55 6 55 54 23 53 52</p>
</triangles> </triangles>
</mesh> </mesh>
<extra>
<technique profile="OpenCOLLADA3dsMax">
<max_box>
<length sid="length" type="float">10</length>
<width sid="width" type="float">10</width>
<height sid="height" type="float">20</height>
<widthsegments sid="widthsegments" type="int">1</widthsegments>
<lengthsegments sid="lengthsegments" type="int">1</lengthsegments>
<heightsegments sid="heightsegments" type="int">5</heightsegments>
<generateuvs sid="generateuvs" type="int">1</generateuvs>
</max_box>
</technique>
</extra>
</geometry> </geometry>
</library_geometries> </library_geometries>
<library_controllers> <library_controllers>
@ -165,7 +504,12 @@
<skeleton>#node-Bone001</skeleton> <skeleton>#node-Bone001</skeleton>
<bind_material> <bind_material>
<technique_common> <technique_common>
<instance_material symbol="ColorMaterial" target="#ColorEffectR26G177B26-material"/> <instance_material symbol="Material__16_1" target="#Material__16-material"/>
<instance_material symbol="Material__17_1" target="#Material__17-material"/>
<instance_material symbol="Material__18_1" target="#Material__18-material"/>
<instance_material symbol="Material__13_1" target="#Material__13-material"/>
<instance_material symbol="Material__14_1" target="#Material__14-material"/>
<instance_material symbol="Material__15_1" target="#Material__15-material"/>
</technique_common> </technique_common>
</bind_material> </bind_material>
</instance_controller> </instance_controller>

Binary file not shown.

View File

@ -21,6 +21,12 @@ namespace collada_scene {
ID3D10EffectMatrixVariable * g_pViewVariable = NULL; ID3D10EffectMatrixVariable * g_pViewVariable = NULL;
ID3D10EffectMatrixVariable * g_pProjectionVariable = NULL; ID3D10EffectMatrixVariable * g_pProjectionVariable = NULL;
ID3D10EffectVectorVariable * g_pEmissionVariable = NULL;
ID3D10EffectVectorVariable * g_pAmbientVariable = NULL;
ID3D10EffectVectorVariable * g_pDiffuseVariable = NULL;
ID3D10EffectVectorVariable * g_pSpecularVariable = NULL;
ID3D10EffectScalarVariable * g_pShininessVariable = NULL;
static inline DXGI_FORMAT dxgi_format(input_format format) static inline DXGI_FORMAT dxgi_format(input_format format)
{ {
switch (format) { switch (format) {
@ -90,7 +96,7 @@ namespace collada_scene {
bd.Usage = D3D10_USAGE_IMMUTABLE; bd.Usage = D3D10_USAGE_IMMUTABLE;
bd.ByteWidth = dwResSize; bd.ByteWidth = dwResSize;
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER; bd.BindFlags = D3D10_BIND_INDEX_BUFFER;
bd.CPUAccessFlags = 0; bd.CPUAccessFlags = 0;
bd.MiscFlags = 0; bd.MiscFlags = 0;
initData.pSysMem = pData; initData.pSysMem = pData;
@ -188,6 +194,12 @@ namespace collada_scene {
g_pViewVariable = g_pEffect->GetVariableByName("View")->AsMatrix(); g_pViewVariable = g_pEffect->GetVariableByName("View")->AsMatrix();
g_pProjectionVariable = g_pEffect->GetVariableByName("Projection")->AsMatrix(); g_pProjectionVariable = g_pEffect->GetVariableByName("Projection")->AsMatrix();
g_pEmissionVariable = g_pEffect->GetVariableByName("Emission")->AsVector();
g_pAmbientVariable = g_pEffect->GetVariableByName("Ambient")->AsVector();
g_pDiffuseVariable = g_pEffect->GetVariableByName("Diffuse")->AsVector();
g_pSpecularVariable = g_pEffect->GetVariableByName("Specular")->AsVector();
g_pShininessVariable = g_pEffect->GetVariableByName("Shininess")->AsScalar();
return S_OK; return S_OK;
} }
@ -232,13 +244,42 @@ namespace collada_scene {
} }
} }
static inline void SetMaterial(effect const& effect)
{
switch (effect.type) {
case effect_type::BLINN:
g_pEmissionVariable->SetFloatVector((float *)&effect.blinn.emission.color.x);
g_pAmbientVariable->SetFloatVector((float *)&effect.blinn.ambient.color.x);
g_pDiffuseVariable->SetFloatVector((float *)&effect.blinn.diffuse.color.x);
g_pSpecularVariable->SetFloatVector((float *)&effect.blinn.specular.color.x);
g_pShininessVariable->SetFloat(effect.blinn.shininess);
break;
case effect_type::LAMBERT:
g_pEmissionVariable->SetFloatVector((float *)&effect.lambert.emission.color.x);
g_pAmbientVariable->SetFloatVector((float *)&effect.lambert.ambient.color.x);
g_pDiffuseVariable->SetFloatVector((float *)&effect.lambert.diffuse.color.x);
break;
case effect_type::PHONG:
g_pEmissionVariable->SetFloatVector((float *)&effect.phong.emission.color.x);
g_pAmbientVariable->SetFloatVector((float *)&effect.phong.ambient.color.x);
g_pDiffuseVariable->SetFloatVector((float *)&effect.phong.diffuse.color.x);
g_pSpecularVariable->SetFloatVector((float *)&effect.phong.specular.color.x);
g_pShininessVariable->SetFloat(effect.phong.shininess);
break;
case effect_type::CONSTANT:
g_pEmissionVariable->SetFloatVector((float *)&effect.constant.color.x);
break;
default:
break;
}
}
void RenderGeometries(scene_state const& state, void RenderGeometries(scene_state const& state,
instance_geometry const * const instance_geometries, instance_geometry const * const instance_geometries,
int const instance_geometries_count) int const instance_geometries_count)
{ {
for (int i = 0; i < instance_geometries_count; i++) { for (int i = 0; i < instance_geometries_count; i++) {
instance_geometry const &instance_geometry = instance_geometries[i]; instance_geometry const &instance_geometry = instance_geometries[i];
mesh const& mesh = instance_geometry.geometry->mesh; mesh const& mesh = instance_geometry.geometry->mesh;
UINT strides[1] = { 3 * 3 * 4 }; UINT strides[1] = { 3 * 3 * 4 };
@ -249,8 +290,10 @@ namespace collada_scene {
D3D10_TECHNIQUE_DESC techDesc; D3D10_TECHNIQUE_DESC techDesc;
g_pTechniqueBlinn->GetDesc(&techDesc); g_pTechniqueBlinn->GetDesc(&techDesc);
for (int j = 0; j < mesh.triangles_count; j++) { for (int j = 0; j < instance_geometry.instance_materials_count; j++) {
triangles const& triangles = mesh.triangles[j]; instance_material const& instance_material = instance_geometry.instance_materials[j];
triangles const& triangles = mesh.triangles[instance_material.element_index];
SetMaterial(*instance_material.material->effect);
g_pTechniqueBlinn->GetPassByIndex(0)->Apply(0); g_pTechniqueBlinn->GetPassByIndex(0)->Apply(0);
g_pd3dDevice->IASetInputLayout(state.pVertexLayouts[triangles.inputs_index]); g_pd3dDevice->IASetInputLayout(state.pVertexLayouts[triangles.inputs_index]);

View File

@ -9,6 +9,15 @@ cbuffer cbMultiplePerFrame
matrix World; matrix World;
}; };
cbuffer cbPerMaterial
{
float4 Emission;
float4 Ambient;
float4 Diffuse;
float4 Specular;
float Shininess;
};
struct VS_INPUT struct VS_INPUT
{ {
float3 Pos : POSITION; float3 Pos : POSITION;
@ -39,8 +48,12 @@ PS_INPUT VS(VS_INPUT input)
float4 PS(PS_INPUT input) : SV_Target float4 PS(PS_INPUT input) : SV_Target
{ {
float4 color = Emission + Diffuse * 1.0 + Specular * 0.0;
return float4(color.xyz, 1);
//return float4(input.Normal * 0.5 + 0.5, 1); //return float4(input.Normal * 0.5 + 0.5, 1);
return float4(input.Tex.xy, 0, 1); //return float4(input.Tex.xy, 0, 1);
} }
BlendState DisableBlending BlendState DisableBlending

View File

@ -1821,7 +1821,7 @@ void Render(float t, float dt)
g_pd3dDevice->ClearDepthStencilView(g_pDepthStencilView, D3D10_CLEAR_DEPTH, 1.0f, 0); g_pd3dDevice->ClearDepthStencilView(g_pDepthStencilView, D3D10_CLEAR_DEPTH, 1.0f, 0);
// render // render
RenderModel(t); //RenderModel(t);
const float ClearColorZero[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; const float ClearColorZero[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
ID3D10RenderTargetView * RenderTargets[] = { ID3D10RenderTargetView * RenderTargets[] = {
@ -1830,19 +1830,19 @@ void Render(float t, float dt)
}; };
g_pd3dDevice->OMSetRenderTargets(2, RenderTargets, g_pDepthStencilView); g_pd3dDevice->OMSetRenderTargets(2, RenderTargets, g_pDepthStencilView);
g_pd3dDevice->ClearRenderTargetView(g_pRenderTargetViewTexture[0], ClearColorZero); g_pd3dDevice->ClearRenderTargetView(g_pRenderTargetViewTexture[0], ClearColorZero);
RenderMeshStatic(cube::node_0.mesh, t); //RenderMeshStatic(cube::node_0.mesh, t);
//RenderBloom(); //RenderBloom();
//print("%f\n", t); //print("%f\n", t);
//RenderVolume(t); //RenderVolume(t);
//RenderVolumeMesh(); //RenderVolumeMesh();
RenderFont(dt);
//collada::Render(t); //collada::Render(t);
collada_scene::Render(curve_interpolation::descriptor, g_SceneState); collada_scene::Render(curve_interpolation::descriptor, g_SceneState);
RenderFont(dt);
// present // present
g_pSwapChain->Present(0, 0); g_pSwapChain->Present(0, 0);
} }