diff --git a/collada/header.py b/collada/header.py index 9ccb6e5..a118115 100644 --- a/collada/header.py +++ b/collada/header.py @@ -1,9 +1,12 @@ -from typing import Dict, List, Any +from typing import Dict, List, Any, Tuple +from operator import attrgetter from collections import defaultdict from dataclasses import dataclass from itertools import islice, chain +from urllib.parse import unquote from io import BytesIO +import os.path import struct from collada.util import matrix_transpose, find_semantics @@ -45,28 +48,58 @@ class State: linearized_nodes: List[types.Node] node_parents: Dict[int, int] + # image_paths: filename: path + image_paths: Dict[str, str] + + # image_indices: image_id: image_index + image_indices: Dict[str, str] + + # resource_names: resource compiler names already emitted + resource_names: Dict[str, str] + + # effect_textures_by_texcoord: (effect_id, channel): [sampler_sid] + effect_textures_by_texcoord: Dict[Tuple[str, str], list] + def __init__(self): self.vertex_buffer = BytesIO() self.index_buffer = BytesIO() self.geometry__indices = {} self.geometry__vertex_index_tables = {} - self.node_names = {} self.symbol_names = {} self.emitted_input_elements_arrays = {} self.node_animation_channels = defaultdict(set) self.linearized_nodes = [] self.node_parents = {} + self.image_paths = {} + self.image_indices = {} + self.resource_names = {} + self.effect_textures_by_texcoord = defaultdict(list) + +def _sanitize(name): + return name.replace(' ', '_').replace('-', '_').replace('.', '_').replace('/', '_') + +def _validate_name_value(name, value): + assert name is not None, name + assert value is not None, value + assert type(name) is str, name + assert '\\' not in name, name + +def sanitize_resource_name(state, name, value): + _validate_name_value(name, value) + assert '/' not in name, name + resource_name = _sanitize(name).upper() + assert resource_name not in state.resource_names or state.resource_names[resource_name] is value + state.resource_names[resource_name] = value + return resource_name def sanitize_name(state, name, value, *, allow_slash=False): - assert name is not None, value - assert type(name) is str + _validate_name_value(name, value) + assert ' ' not in name, name if not allow_slash: assert '/' not in name, name - c_id = name.lower().replace('-', '_').replace('.', '_').replace('/', '_') - - assert c_id not in state.node_names or state.node_names[c_id] is value + c_id = _sanitize(name).lower() + assert c_id not in state.symbol_names or state.symbol_names[c_id] is value state.symbol_names[c_id] = value - return c_id def render_matrix(fs): @@ -243,6 +276,23 @@ def find_material_symbol(geometry, material_symbol): return i # element index assert False, material_symbol +def shader_to_input_set(channel_to_input_set, shader, op): + if type(shader) is types.Constant: + return -1 + + shader_op = op(shader) + + if type(shader_op) is types.Color: + return -1 + if shader_op is None: + return -1 + + assert type(shader_op) is types.Texture + texture = shader_op + assert texture.texcoord in channel_to_input_set + + return channel_to_input_set[texture.texcoord] + def render_node_instance_geometry_instance_materials(state, collada, node_name, i, geometry, instance_materials): yield f"instance_material const instance_materials_{node_name}_{i}[] = {{" for instance_material in instance_materials: @@ -256,9 +306,32 @@ def render_node_instance_geometry_instance_materials(state, collada, node_name, material = collada.lookup(instance_material.target, types.Material) material_name = sanitize_name(state, material.id, material) + channel_to_input_set = {} + for bind_vertex_input in instance_material.bind_vertex_inputs: + assert bind_vertex_input.input_semantic == "TEXCOORD", bind_vertex_input + if bind_vertex_input.semantic in channel_to_input_set: + assert channel_to_input_set[bind_vertex_input.semantic] == bind_vertex_input.input_set + else: + channel_to_input_set[bind_vertex_input.semantic] = bind_vertex_input.input_set + + + effect = collada.lookup(material.instance_effect.url, types.Effect) + profile_common, = effect.profile_common + shader = profile_common.technique.shader + + emission_input_set = shader_to_input_set(channel_to_input_set, shader, attrgetter("emission")) + ambient_input_set = shader_to_input_set(channel_to_input_set, shader, attrgetter("ambient")) + diffuse_input_set = shader_to_input_set(channel_to_input_set, shader, attrgetter("diffuse")) + specular_input_set = shader_to_input_set(channel_to_input_set, shader, attrgetter("specular")) + yield "{" yield f".element_index = {element_index}, // an index into mesh.triangles" yield f".material = &material_{material_name}," + yield "" + yield f".emission = {{ .input_set = {emission_input_set} }}," + yield f".ambient = {{ .input_set = {ambient_input_set} }}," + yield f".diffuse = {{ .input_set = {diffuse_input_set} }}," + yield f".specular = {{ .input_set = {specular_input_set} }}," yield "}," yield "};" @@ -391,14 +464,39 @@ def render_header(namespace): yield 'using namespace collada;' def render_opt_color(field_name, color): - yield f".color = {render_float_tuple(color.value)}," + yield f".{field_name} = {render_float_tuple(color.value)}," -def render_opt_color_or_texture(field_name, color_or_texture): +def render_opt_texture(state, profile_common, field_name, texture): + sampler_sid = texture.texture + sampler = profile_common.sid_lookup[sampler_sid] + assert type(sampler) is types.Newparam, sampler + assert type(sampler.parameter_type) is types.Sampler2D, sampler + + surface_sid = sampler.parameter_type.source.sid + surface = profile_common.sid_lookup[surface_sid] + assert type(surface) is types.Newparam, surface + assert type(surface.parameter_type) is types.Surface, surface + assert surface.parameter_type.type is types.FxSurfaceType._2D + image_id = surface.parameter_type.init_from.uri + image_index = state.image_indices[image_id] + + yield f".{field_name} = {{ .image_index = {image_index} }}," + +def render_opt_color_or_texture(state, profile_common, field_name, color_or_texture): if color_or_texture is None: color_or_texture = types.Color(value=(0.0, 0.0, 0.0, 0.0)) - assert type(color_or_texture) is types.Color, color_or_texture + opt_type = { + types.Color: "COLOR", + types.Texture: "TEXTURE", + }[type(color_or_texture)] yield f".{field_name} = {{" - yield from render_opt_color("color", color_or_texture) + yield f".type = color_or_texture_type::{opt_type}," + if type(color_or_texture) is types.Color: + yield from render_opt_color("color", color_or_texture) + elif type(color_or_texture) is types.Texture: + yield from render_opt_texture(state, profile_common, "texture", color_or_texture) + else: + assert False, color_or_texture yield "}," def render_opt_float(field_name, f): @@ -408,7 +506,7 @@ def render_opt_float(field_name, f): def render_effect(state, collada, effect): profile_common, = effect.profile_common - assert profile_common.newparam == [] + shader = profile_common.technique.shader effect_name = sanitize_name(state, effect.id, effect) yield f"effect const effect_{effect_name} = {{" @@ -416,40 +514,40 @@ def render_effect(state, collada, effect): if type(shader) is types.Blinn: yield ".type = effect_type::BLINN," yield ".blinn = {" - yield from render_opt_color_or_texture("emission", shader.emission) - yield from render_opt_color_or_texture("ambient", shader.ambient) - yield from render_opt_color_or_texture("diffuse", shader.diffuse) - yield from render_opt_color_or_texture("specular", shader.specular) + yield from render_opt_color_or_texture(state, profile_common, "emission", shader.emission) + yield from render_opt_color_or_texture(state, profile_common, "ambient", shader.ambient) + yield from render_opt_color_or_texture(state, profile_common, "diffuse", shader.diffuse) + yield from render_opt_color_or_texture(state, profile_common, "specular", shader.specular) yield from render_opt_float("shininess", shader.shininess) - yield from render_opt_color_or_texture("reflective", shader.reflective) + yield from render_opt_color_or_texture(state, profile_common, "reflective", shader.reflective) yield from render_opt_float("reflectivity", shader.reflectivity) - yield from render_opt_color_or_texture("transparent", shader.transparent) + yield from render_opt_color_or_texture(state, profile_common, "transparent", shader.transparent) yield from render_opt_float("transparency", shader.transparency) yield from render_opt_float("index_of_refraction", shader.index_of_refraction) yield "}" elif type(shader) is types.Lambert: yield ".type = effect_type::LAMBERT," yield ".lambert = {" - yield from render_opt_color_or_texture("emission", shader.emission) - yield from render_opt_color_or_texture("ambient", shader.ambient) - yield from render_opt_color_or_texture("diffuse", shader.diffuse) - yield from render_opt_color_or_texture("reflective", shader.reflective) + yield from render_opt_color_or_texture(state, profile_common, "emission", shader.emission) + yield from render_opt_color_or_texture(state, profile_common, "ambient", shader.ambient) + yield from render_opt_color_or_texture(state, profile_common, "diffuse", shader.diffuse) + yield from render_opt_color_or_texture(state, profile_common, "reflective", shader.reflective) yield from render_opt_float("reflectivity", shader.reflectivity) - yield from render_opt_color_or_texture("transparent", shader.transparent) + yield from render_opt_color_or_texture(state, profile_common, "transparent", shader.transparent) yield from render_opt_float("transparency", shader.transparency) yield from render_opt_float("index_of_refraction", shader.index_of_refraction) yield "}" elif type(shader) is types.Phong: yield ".type = effect_type::PHONG," yield ".phong = {" - yield from render_opt_color_or_texture("emission", shader.emission) - yield from render_opt_color_or_texture("ambient", shader.ambient) - yield from render_opt_color_or_texture("diffuse", shader.diffuse) - yield from render_opt_color_or_texture("specular", shader.specular) + yield from render_opt_color_or_texture(state, profile_common, "emission", shader.emission) + yield from render_opt_color_or_texture(state, profile_common, "ambient", shader.ambient) + yield from render_opt_color_or_texture(state, profile_common, "diffuse", shader.diffuse) + yield from render_opt_color_or_texture(state, profile_common, "specular", shader.specular) yield from render_opt_float("shininess", shader.shininess) - yield from render_opt_color_or_texture("reflective", shader.reflective) + yield from render_opt_color_or_texture(state, profile_common, "reflective", shader.reflective) yield from render_opt_float("reflectivity", shader.reflectivity) - yield from render_opt_color_or_texture("transparent", shader.transparent) + yield from render_opt_color_or_texture(state, profile_common, "transparent", shader.transparent) yield from render_opt_float("transparency", shader.transparency) yield from render_opt_float("index_of_refraction", shader.index_of_refraction) yield "}" @@ -457,9 +555,9 @@ def render_effect(state, collada, effect): yield ".type = effect_type::CONSTANT," yield ".constant = {" yield from render_opt_color("color", shader.color) - yield from render_opt_color_or_texture("reflective", shader.reflective) + yield from render_opt_color_or_texture(state, profile_common, "reflective", shader.reflective) yield from render_opt_float("reflectivity", shader.reflectivity) - yield from render_opt_color_or_texture("transparent", shader.transparent) + yield from render_opt_color_or_texture(state, profile_common, "transparent", shader.transparent) yield from render_opt_float("transparency", shader.transparency) yield from render_opt_float("index_of_refraction", shader.index_of_refraction) yield "}" @@ -501,6 +599,9 @@ def render_descriptor(namespace): yield "" yield ".inputs_list = inputs_list," yield ".inputs_list_count = (sizeof (inputs_list)) / (sizeof (inputs_list[0]))," + yield "" + yield ".images = images," + yield ".images_count = (sizeof (images)) / (sizeof (images[0]))," yield "};" def render_end_of_namespace(): @@ -695,12 +796,63 @@ def render_library_lights(state, collada): for light in library_lights.lights: yield from render_light(state, collada, light) +def escape_space(s): + def _escape_space(s): + for c in s: + if c == ' ': + yield '\\' + yield c + return str(_escape_space(s)) + +def image_resource_name(state, uri): + uri = unquote(uri) + prefix = "file:///" + assert uri.startswith(prefix), uri + path = uri[len(prefix):] + assert os.path.exists(path), path + image_extensions = {".png", ".jpg", ".bmp", ".jpeg", ".tiff"} + assert os.path.splitext(path)[1].lower() in image_extensions, path + + filename = os.path.split(path)[1] + assert filename not in state.image_paths, filename + state.image_paths[filename] = path + return sanitize_resource_name(state, filename, path.lower()) + +def render_image(state, collada, image, image_index): + assert image.id is not None + assert image.id not in state.image_indices + state.image_indices[image.id] = image_index + + assert type(image.image_source) is types.InitFrom + resource_name = image_resource_name(state, image.image_source.uri) + image_name = sanitize_name(state, image.id, image) + + yield f"// image_index: {image_index}" + yield f"image const image_{image_name} = {{" + yield f'.resource_name = L"{resource_name}",' + yield "};" + +def render_library_images(state, collada): + image_index = 0 + for library_images in collada.library_images: + for image in library_images.images: + yield from render_image(state, collada, image, image_index) + image_index += 1 + + yield "image const * const images[] = {" + for library_images in collada.library_images: + for image in library_images.images: + image_name = sanitize_name(state, image.id, image) + yield f"&image_{image_name}," + yield "};" + def render_all(collada, namespace): state = State() render, out = renderer() render(render_header(namespace)) render(render_library_lights(state, collada)) render(render_library_animations(state, collada)) + render(render_library_images(state, collada)) render(render_library_effects(state, collada)) render(render_library_materials(state, collada)) render(render_library_geometries(state, collada)) diff --git a/include/collada_types.hpp b/include/collada_types.hpp index 775dda6..9f9623e 100644 --- a/include/collada_types.hpp +++ b/include/collada_types.hpp @@ -96,13 +96,32 @@ namespace collada { float3 color; }; + ////////////////////////////////////////////////////////////////////// + // image + ////////////////////////////////////////////////////////////////////// + + struct image { + const wchar_t * resource_name; + }; + ////////////////////////////////////////////////////////////////////// // effect ////////////////////////////////////////////////////////////////////// + enum color_or_texture_type { + COLOR, + TEXTURE, + }; + + struct texture { + int const image_index; // index in to images + }; + struct color_or_texture { + color_or_texture_type type; union { float4 color; + texture texture; }; }; @@ -216,9 +235,19 @@ namespace collada { effect const * const effect; }; + struct bind_vertex_input { + int input_set; // TEXCOORD semantic input slot + }; + struct instance_material { - int element_index; // an index into mesh.triangles + int const element_index; // an index into mesh.triangles material const * const material; + + // heavily simplified from collada data model + bind_vertex_input const emission; + bind_vertex_input const ambient; + bind_vertex_input const diffuse; + bind_vertex_input const specular; }; struct instance_geometry { @@ -328,6 +357,9 @@ namespace collada { inputs const * const inputs_list; int const inputs_list_count; + image const * const * const images; + int const images_count; + //animation const * const animations; //int const animations_count; }; diff --git a/scenes/curve_interpolation/curve_interpolation.DAE b/scenes/curve_interpolation/curve_interpolation.DAE index 99a9bce..4a51511 100755 --- a/scenes/curve_interpolation/curve_interpolation.DAE +++ b/scenes/curve_interpolation/curve_interpolation.DAE @@ -6,8 +6,8 @@ OpenCOLLADA for 3ds Max; Version: 1.6; Revision: 68 file:///C:/cygwin/home/bilbo/d3d10/scenes/curve_interpolation/curve_interpolation.max - 2026-01-28T15:18:44 - 2026-01-28T15:18:44 + 2026-01-29T17:33:59 + 2026-01-29T17:33:59 Z_UP @@ -377,18 +377,31 @@ - + + + + SiteWork_Planting_Grass_Bermuda1_jpg + + + + + SiteWork_Planting_Grass_Bermuda1_jpg-surface + + - + + + 0 0 0 1 + - 0.8980392 0.6039216 0.8431373 1 + 0.588 0.588 0.588 1 - 0.8980392 0.6039216 0.8431373 1 + - 1 1 1 1 + 0 0 0 1 10 @@ -396,28 +409,85 @@ 0 0 0 1 - + 1 1 1 1 1 - + + + + + 0 + 0 + 0 + 1.5 + 1 + 0 + 0 + 0 + 3 + + + 1 + 1 + 0 + 0 + 0 + 0 + 0.1 + + + - + + + + american_cherry_png + + + + + american_cherry_png-surface + + + + + Finishes_Flooring_Tile_Square_Medium_Blue_png + + + + + Finishes_Flooring_Tile_Square_Medium_Blue_png-surface + + + + + _02_png + + + + + _02_png-surface + + - + + + 0 0 0 1 + - 0.1098039 0.5843137 0.6941176 1 + 0.588 0.588 0.588 1 - 0.1098039 0.5843137 0.6941176 1 + - 1 1 1 1 + 10 @@ -425,15 +495,46 @@ 0 0 0 1 - + 1 1 1 1 1 - + + + + + + + + + + + + 0 + 0 + 0 + 1.5 + 1 + 0 + 0 + 0 + 3 + + + 1 + 1 + 0 + 0 + 0 + 0 + 0.1 + + + @@ -525,12 +626,6 @@ - - - - - - @@ -552,6 +647,12 @@ + + + + + + @@ -713,7 +814,7 @@ - 0.5975444 0.9903928 -0.25 0.691341 0.9619401 -0.25 0.7777845 0.9157352 -0.25 0.8535529 0.8535539 -0.25 0.9157345 0.7777857 -0.25 0.9619396 0.6913422 -0.25 0.9903926 0.5975457 -0.25 1 0.5000005 -0.25 0.9903927 0.4024553 -0.25 0.9619399 0.3086587 -0.25 0.915735 0.2222152 -0.25 0.8535537 0.1464469 -0.25 0.7777854 0.08426532 -0.25 0.6913419 0.03806034 -0.25 0.5975454 0.009607404 -0.25 0.5000002 0 -0.25 0.402455 0.009607315 -0.25 0.3086584 0.03806019 -0.25 0.2222149 0.08426517 -0.25 0.1464466 0.1464466 -0.25 0.08426517 0.2222149 -0.25 0.03806019 0.3086583 -0.25 0.009607345 0.4024549 -0.25 0 0.5 -0.25 0.009607345 0.5975451 -0.25 0.03806022 0.6913417 -0.25 0.08426517 0.7777851 -0.25 0.1464466 0.8535534 -0.25 0.2222148 0.9157348 -0.25 0.3086582 0.9619398 -0.25 0.4024548 0.9903927 -0.25 0.5 1 -0.25 + 1.999001 0.9999998 0.5 1.979805 1.194895 0.5 1.922957 1.382301 0.5 1.830639 1.555015 0.5 1.706401 1.7064 0.5 1.555015 1.830639 0.5 1.382301 1.922956 0.5 1.194896 1.979805 0.5 1 1.999001 0.5 0.8051049 1.979805 0.5 0.6176993 1.922957 0.5 0.444985 1.830639 0.5 0.2935998 1.706401 0.5 0.1693612 1.555015 0.5 0.07704347 1.382301 0.5 0.02019453 1.194895 0.5 9.99033e-4 0.9999999 0.5 0.02019459 0.8051044 0.5 0.07704353 0.6176987 0.5 0.1693612 0.4449845 0.5 0.2936 0.2935994 0.5 0.4449852 0.1693608 0.5 0.6176994 0.07704329 0.5 0.8051052 0.02019441 0.5 1.000001 9.99033e-4 0.5 1.194896 0.02019471 0.5 1.382302 0.07704371 0.5 1.555016 0.1693616 0.5 1.706401 0.2936004 0.5 1.83064 0.4449857 0.5 1.922957 0.6177 0.5 1.979806 0.8051058 0.5 @@ -725,11 +826,11 @@ - + -

0 0 31 1 1 30 2 2 29 2 2 29 3 3 28 4 4 27 0 0 31 2 2 29 4 4 27 4 4 27 5 5 26 6 6 25 6 6 25 7 7 24 8 8 23 4 4 27 6 6 25 8 8 23 0 0 31 4 4 27 8 8 23 8 8 23 9 9 22 10 10 21 10 10 21 11 11 20 12 12 19 8 8 23 10 10 21 12 12 19 12 12 19 13 13 18 14 14 17 14 14 17 15 15 16 16 16 15 12 12 19 14 14 17 16 16 15 8 8 23 12 12 19 16 16 15 0 0 31 8 8 23 16 16 15 16 16 15 17 17 14 18 18 13 18 18 13 19 19 12 20 20 11 16 16 15 18 18 13 20 20 11 20 20 11 21 21 10 22 22 9 22 22 9 23 23 8 24 24 7 20 20 11 22 22 9 24 24 7 16 16 15 20 20 11 24 24 7 0 0 31 16 16 15 24 24 7 24 24 7 25 25 6 26 26 5 26 26 5 27 27 4 28 28 3 24 24 7 26 26 5 28 28 3 0 0 31 24 24 7 28 28 3 28 28 3 29 29 2 30 30 1 0 0 31 28 28 3 30 30 1 31 31 0 0 0 31 30 30 1

+

0 0 0 1 1 1 2 2 2 2 2 2 3 3 3 4 4 4 0 0 0 2 2 2 4 4 4 4 4 4 5 5 5 6 6 6 6 6 6 7 7 7 8 8 8 4 4 4 6 6 6 8 8 8 0 0 0 4 4 4 8 8 8 8 8 8 9 9 9 10 10 10 10 10 10 11 11 11 12 12 12 8 8 8 10 10 10 12 12 12 12 12 12 13 13 13 14 14 14 14 14 14 15 15 15 16 16 16 12 12 12 14 14 14 16 16 16 8 8 8 12 12 12 16 16 16 0 0 0 8 8 8 16 16 16 16 16 16 17 17 17 18 18 18 18 18 18 19 19 19 20 20 20 16 16 16 18 18 18 20 20 20 20 20 20 21 21 21 22 22 22 22 22 22 23 23 23 24 24 24 20 20 20 22 22 22 24 24 24 16 16 16 20 20 20 24 24 24 0 0 0 16 16 16 24 24 24 24 24 24 25 25 25 26 26 26 26 26 26 27 27 27 28 28 28 24 24 24 26 26 26 28 28 28 0 0 0 24 24 24 28 28 28 28 28 28 29 29 29 30 30 30 0 0 0 28 28 28 30 30 30 31 31 31 0 0 0 30 30 30

@@ -756,9 +857,9 @@
- 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 1 0 + 9.99093e-4 9.9957e-4 1 1.999 9.99093e-4 1 9.9957e-4 1.999001 1 1.999001 1.999 1 - + @@ -768,26 +869,13 @@ - + -

2 0 6 0 1 4 3 2 7 1 3 5 3 2 7 0 1 4

+

2 0 2 0 1 0 3 2 3 1 3 1 3 2 3 0 1 0

- - - - 14.14213 - 14.14213 - 1 - 1 - 1 - 1 - 1 - - - @@ -902,19 +990,21 @@ - + 1 1 1 - + 0 + 0 + 1 + - 0 1 1 2 1 - 10 + 20 0 0 7 @@ -930,6 +1020,20 @@ + + + file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Materials/Textures/1/Mats/american_cherry.png + + + file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Materials/Textures/3/Mats/102.png + + + file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Materials/Textures/3/Mats/Finishes.Flooring.Tile.Square.Medium%20Blue.png + + + file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Materials/Textures/3/Mats/SiteWork.Planting.Grass.Bermuda1.jpg + + @@ -984,7 +1088,9 @@ - + + + @@ -1003,7 +1109,11 @@ - + + + + + @@ -1037,7 +1147,7 @@ - 2.124535 8.291501 6.185831 + 2.124535 8.291501 6.185831 0.5773504 -0.5773501 -0.5773504 -120 @@ -1302,6 +1412,132 @@
+ + 0 0.5 1 1.5 2 2.833333 3.333333 + + + + + + + + 2.124535 -5.611371 -5.611371 0.04967833 0.04967833 2.124535 2.124535 + + + + + + + + 0.9997917 2.124535 0.33335 -5.611371 0.83335 -5.611371 1.33335 0.04967833 1.83335 0.04967833 2.555583 2.124535 3.166683 2.124535 + + + + + + + + + 0.16665 2.124535 0.66665 -5.611371 1.16665 -5.611371 1.66665 0.04967833 2.27775 0.04967833 2.999983 2.124535 3.666564 2.124535 + + + + + + + + + BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER + + + + + + + + 0 0.5 1 1.5 2 2.833333 3.333333 + + + + + + + + 8.291501 0.2940993 0.2940993 -3.820096 -3.820096 8.291501 8.291501 + + + + + + + + 0.9997917 8.291501 0.33335 0.2940993 0.83335 0.2940993 1.33335 -3.820096 1.83335 -3.820096 2.555583 8.291501 3.166683 8.291501 + + + + + + + + + 0.16665 8.291501 0.66665 0.2940993 1.16665 0.2940993 1.66665 -3.820096 2.27775 -3.820096 2.999983 8.291501 3.666564 8.291501 + + + + + + + + + BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER + + + + + + + + 0 0.5 1 1.5 2 2.833333 3.333333 + + + + + + + + 6.185831 6.185831 6.185831 6.185831 6.185831 6.185831 6.185831 + + + + + + + + 0.9997917 6.185831 0.33335 6.185831 0.83335 6.185831 1.33335 6.185831 1.83335 6.185831 2.555583 6.185831 3.166683 6.185831 + + + + + + + + + 0.16665 6.185831 0.66665 6.185831 1.16665 6.185831 1.66665 6.185831 2.27775 6.185831 2.999983 6.185831 3.666564 6.185831 + + + + + + + + + BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER BEZIER + + + + + + @@ -1340,12 +1576,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/scenes/curve_interpolation/curve_interpolation.max b/scenes/curve_interpolation/curve_interpolation.max index 1a8671c..2c3710a 100755 Binary files a/scenes/curve_interpolation/curve_interpolation.max and b/scenes/curve_interpolation/curve_interpolation.max differ diff --git a/scenes/curve_interpolation/curve_interpolation.vtx b/scenes/curve_interpolation/curve_interpolation.vtx index 60046c8..67faa88 100644 Binary files a/scenes/curve_interpolation/curve_interpolation.vtx and b/scenes/curve_interpolation/curve_interpolation.vtx differ diff --git a/src/effect/collada_scene.fx b/src/effect/collada_scene.fx index 31e3cad..0f91ecd 100644 --- a/src/effect/collada_scene.fx +++ b/src/effect/collada_scene.fx @@ -22,6 +22,19 @@ cbuffer cbPerMaterial float4 Diffuse; float4 Specular; float Shininess; + + int4 TextureChannel; +}; + +Texture2D TexEmission; +Texture2D TexAmbient; +Texture2D TexDiffuse; +Texture2D TexSpecular; + +SamplerState samLinear { + Filter = MIN_MAG_MIP_LINEAR; + AddressU = Wrap; + AddressV = Wrap; }; struct VS_INPUT diff --git a/src/scenes/curve_interpolation/curve_interpolation.cpp b/src/scenes/curve_interpolation/curve_interpolation.cpp index e47226c..880751b 100644 --- a/src/scenes/curve_interpolation/curve_interpolation.cpp +++ b/src/scenes/curve_interpolation/curve_interpolation.cpp @@ -10,7 +10,7 @@ light const light_environmentambientlight = { }; light const light_light_light = { - .type = light_type::DIRECTIONAL, + .type = light_type::POINT, .color = { 1.0f, 1.0f, 1.0f }, }; @@ -364,6 +364,255 @@ sampler const sampler_node_geosphere_scaleaxisrotation_sampler = { }, }; +float const array_node_light_translation_x_input_array[] = { + 0.0f, + 0.5f, + 1.0f, + 1.5f, + 2.0f, + 2.833333f, + 3.333333f, +}; + +float const array_node_light_translation_x_output_array[] = { + 2.124535f, + -5.611371f, + -5.611371f, + 0.04967833f, + 0.04967833f, + 2.124535f, + 2.124535f, +}; + +float const array_node_light_translation_x_intangent_array[] = { + 0.9997917f, 2.124535f, + 0.33335f, -5.611371f, + 0.83335f, -5.611371f, + 1.33335f, 0.04967833f, + 1.83335f, 0.04967833f, + 2.555583f, 2.124535f, + 3.166683f, 2.124535f, +}; + +float const array_node_light_translation_x_outtangent_array[] = { + 0.16665f, 2.124535f, + 0.66665f, -5.611371f, + 1.16665f, -5.611371f, + 1.66665f, 0.04967833f, + 2.27775f, 0.04967833f, + 2.999983f, 2.124535f, + 3.666564f, 2.124535f, +}; + +enum interpolation const array_node_light_translation_x_interpolation_array[] = { + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, +}; + +sampler const sampler_node_light_translation_x_sampler = { + // node_light_translation_x_input + .input = { + .float_array = array_node_light_translation_x_input_array, + .count = 7, + .stride = 1, + }, + // node_light_translation_x_output + .output = { + .float_array = array_node_light_translation_x_output_array, + .count = 7, + .stride = 1, + }, + // node_light_translation_x_intangent + .in_tangent = { + .float_array = array_node_light_translation_x_intangent_array, + .count = 7, + .stride = 2, + }, + // node_light_translation_x_outtangent + .out_tangent = { + .float_array = array_node_light_translation_x_outtangent_array, + .count = 7, + .stride = 2, + }, + // node_light_translation_x_interpolation + .interpolation = { + .interpolation_array = array_node_light_translation_x_interpolation_array, + .count = 7, + .stride = 1, + }, +}; + +float const array_node_light_translation_y_input_array[] = { + 0.0f, + 0.5f, + 1.0f, + 1.5f, + 2.0f, + 2.833333f, + 3.333333f, +}; + +float const array_node_light_translation_y_output_array[] = { + 8.291501f, + 0.2940993f, + 0.2940993f, + -3.820096f, + -3.820096f, + 8.291501f, + 8.291501f, +}; + +float const array_node_light_translation_y_intangent_array[] = { + 0.9997917f, 8.291501f, + 0.33335f, 0.2940993f, + 0.83335f, 0.2940993f, + 1.33335f, -3.820096f, + 1.83335f, -3.820096f, + 2.555583f, 8.291501f, + 3.166683f, 8.291501f, +}; + +float const array_node_light_translation_y_outtangent_array[] = { + 0.16665f, 8.291501f, + 0.66665f, 0.2940993f, + 1.16665f, 0.2940993f, + 1.66665f, -3.820096f, + 2.27775f, -3.820096f, + 2.999983f, 8.291501f, + 3.666564f, 8.291501f, +}; + +enum interpolation const array_node_light_translation_y_interpolation_array[] = { + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, +}; + +sampler const sampler_node_light_translation_y_sampler = { + // node_light_translation_y_input + .input = { + .float_array = array_node_light_translation_y_input_array, + .count = 7, + .stride = 1, + }, + // node_light_translation_y_output + .output = { + .float_array = array_node_light_translation_y_output_array, + .count = 7, + .stride = 1, + }, + // node_light_translation_y_intangent + .in_tangent = { + .float_array = array_node_light_translation_y_intangent_array, + .count = 7, + .stride = 2, + }, + // node_light_translation_y_outtangent + .out_tangent = { + .float_array = array_node_light_translation_y_outtangent_array, + .count = 7, + .stride = 2, + }, + // node_light_translation_y_interpolation + .interpolation = { + .interpolation_array = array_node_light_translation_y_interpolation_array, + .count = 7, + .stride = 1, + }, +}; + +float const array_node_light_translation_z_input_array[] = { + 0.0f, + 0.5f, + 1.0f, + 1.5f, + 2.0f, + 2.833333f, + 3.333333f, +}; + +float const array_node_light_translation_z_output_array[] = { + 6.185831f, + 6.185831f, + 6.185831f, + 6.185831f, + 6.185831f, + 6.185831f, + 6.185831f, +}; + +float const array_node_light_translation_z_intangent_array[] = { + 0.9997917f, 6.185831f, + 0.33335f, 6.185831f, + 0.83335f, 6.185831f, + 1.33335f, 6.185831f, + 1.83335f, 6.185831f, + 2.555583f, 6.185831f, + 3.166683f, 6.185831f, +}; + +float const array_node_light_translation_z_outtangent_array[] = { + 0.16665f, 6.185831f, + 0.66665f, 6.185831f, + 1.16665f, 6.185831f, + 1.66665f, 6.185831f, + 2.27775f, 6.185831f, + 2.999983f, 6.185831f, + 3.666564f, 6.185831f, +}; + +enum interpolation const array_node_light_translation_z_interpolation_array[] = { + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, + interpolation::BEZIER, +}; + +sampler const sampler_node_light_translation_z_sampler = { + // node_light_translation_z_input + .input = { + .float_array = array_node_light_translation_z_input_array, + .count = 7, + .stride = 1, + }, + // node_light_translation_z_output + .output = { + .float_array = array_node_light_translation_z_output_array, + .count = 7, + .stride = 1, + }, + // node_light_translation_z_intangent + .in_tangent = { + .float_array = array_node_light_translation_z_intangent_array, + .count = 7, + .stride = 2, + }, + // node_light_translation_z_outtangent + .out_tangent = { + .float_array = array_node_light_translation_z_outtangent_array, + .count = 7, + .stride = 2, + }, + // node_light_translation_z_interpolation + .interpolation = { + .interpolation_array = array_node_light_translation_z_interpolation_array, + .count = 7, + .stride = 1, + }, +}; + channel const node_channel_node_cube_translation_x = { .source_sampler = &sampler_node_cube_translation_x_sampler, .target_transform_index = 0, @@ -400,27 +649,78 @@ channel const node_channel_node_geosphere_scaleaxisrotation = { .target_attribute = target_attribute::ALL, }; +channel const node_channel_node_light_translation_x = { + .source_sampler = &sampler_node_light_translation_x_sampler, + .target_transform_index = 0, + .target_attribute = target_attribute::X, +}; + +channel const node_channel_node_light_translation_y = { + .source_sampler = &sampler_node_light_translation_y_sampler, + .target_transform_index = 0, + .target_attribute = target_attribute::Y, +}; + +channel const node_channel_node_light_translation_z = { + .source_sampler = &sampler_node_light_translation_z_sampler, + .target_transform_index = 0, + .target_attribute = target_attribute::Z, +}; + +// image_index: 0 +image const image_american_cherry_png = { + .resource_name = L"AMERICAN_CHERRY_PNG", +}; + +// image_index: 1 +image const image__02_png = { + .resource_name = L"102_PNG", +}; + +// image_index: 2 +image const image_finishes_flooring_tile_square_medium_blue_png = { + .resource_name = L"FINISHES_FLOORING_TILE_SQUARE_MEDIUM_BLUE_PNG", +}; + +// image_index: 3 +image const image_sitework_planting_grass_bermuda1_jpg = { + .resource_name = L"SITEWORK_PLANTING_GRASS_BERMUDA1_JPG", +}; + +image const * const images[] = { + &image_american_cherry_png, + &image__02_png, + &image_finishes_flooring_tile_square_medium_blue_png, + &image_sitework_planting_grass_bermuda1_jpg, +}; + effect const effect_material__15 = { .type = effect_type::BLINN, .blinn = { .emission = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {0.6705883f, 0.5843138f, 1.0f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {0.6705883f, 0.5843138f, 1.0f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -432,23 +732,29 @@ effect const effect_material__16 = { .type = effect_type::BLINN, .blinn = { .emission = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {0.5803922f, 1.0f, 0.9647059f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {0.5803922f, 1.0f, 0.9647059f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -460,23 +766,29 @@ effect const effect_material__17 = { .type = effect_type::BLINN, .blinn = { .emission = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {0.6509804f, 1.0f, 0.5803922f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {0.6509804f, 1.0f, 0.5803922f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -488,23 +800,29 @@ effect const effect_material__18 = { .type = effect_type::BLINN, .blinn = { .emission = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {0.9333334f, 1.0f, 0.5647059f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {0.9333334f, 1.0f, 0.5647059f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -516,23 +834,29 @@ effect const effect_material__19 = { .type = effect_type::BLINN, .blinn = { .emission = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 0.7686275f, 0.5803922f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 0.7686275f, 0.5803922f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -544,23 +868,29 @@ effect const effect_material__20 = { .type = effect_type::BLINN, .blinn = { .emission = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 0.5803922f, 0.5803922f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 0.5803922f, 0.5803922f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -572,23 +902,29 @@ effect const effect_coloreffectr26g177b26 = { .type = effect_type::PHONG, .phong = { .emission = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 0.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {0.1019608f, 0.6941176f, 0.1019608f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {0.1019608f, 0.6941176f, 0.1019608f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -596,27 +932,33 @@ effect const effect_coloreffectr26g177b26 = { } }; -effect const effect_coloreffectr229g154b215 = { - .type = effect_type::PHONG, - .phong = { +effect const effect_grass = { + .type = effect_type::BLINN, + .blinn = { .emission = { - .color = {0.0f, 0.0f, 0.0f, 0.0f}, + .type = color_or_texture_type::COLOR, + .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .ambient = { - .color = {0.8980392f, 0.6039216f, 0.8431373f, 1.0f}, + .type = color_or_texture_type::COLOR, + .color = {0.588f, 0.588f, 0.588f, 1.0f}, }, .diffuse = { - .color = {0.8980392f, 0.6039216f, 0.8431373f, 1.0f}, + .type = color_or_texture_type::TEXTURE, + .texture = { .image_index = 3 }, }, .specular = { - .color = {1.0f, 1.0f, 1.0f, 1.0f}, + .type = color_or_texture_type::COLOR, + .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -624,27 +966,33 @@ effect const effect_coloreffectr229g154b215 = { } }; -effect const effect_coloreffectr28g149b177 = { - .type = effect_type::PHONG, - .phong = { +effect const effect_wood = { + .type = effect_type::BLINN, + .blinn = { .emission = { - .color = {0.0f, 0.0f, 0.0f, 0.0f}, + .type = color_or_texture_type::COLOR, + .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .ambient = { - .color = {0.1098039f, 0.5843137f, 0.6941176f, 1.0f}, + .type = color_or_texture_type::COLOR, + .color = {0.588f, 0.588f, 0.588f, 1.0f}, }, .diffuse = { - .color = {0.1098039f, 0.5843137f, 0.6941176f, 1.0f}, + .type = color_or_texture_type::TEXTURE, + .texture = { .image_index = 0 }, }, .specular = { - .color = {1.0f, 1.0f, 1.0f, 1.0f}, + .type = color_or_texture_type::TEXTURE, + .texture = { .image_index = 2 }, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -656,23 +1004,29 @@ effect const effect_coloreffectr198g224b87 = { .type = effect_type::PHONG, .phong = { .emission = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 0.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {0.7764706f, 0.8784314f, 0.3411765f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {0.7764706f, 0.8784314f, 0.3411765f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -684,23 +1038,29 @@ effect const effect_lightemit = { .type = effect_type::BLINN, .blinn = { .emission = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .ambient = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .diffuse = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .specular = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .shininess = 10.0f, .reflective = { + .type = color_or_texture_type::COLOR, .color = {0.0f, 0.0f, 0.0f, 1.0f}, }, .reflectivity = 0.0f, .transparent = { + .type = color_or_texture_type::COLOR, .color = {1.0f, 1.0f, 1.0f, 1.0f}, }, .transparency = 1.0f, @@ -712,14 +1072,6 @@ material const material_coloreffectr26g177b26_material = { .effect = &effect_coloreffectr26g177b26, }; -material const material_coloreffectr229g154b215_material = { - .effect = &effect_coloreffectr229g154b215, -}; - -material const material_coloreffectr28g149b177_material = { - .effect = &effect_coloreffectr28g149b177, -}; - material const material_coloreffectr198g224b87_material = { .effect = &effect_coloreffectr198g224b87, }; @@ -748,6 +1100,14 @@ material const material_material__20_material = { .effect = &effect_material__20, }; +material const material_grass_material = { + .effect = &effect_grass, +}; + +material const material_wood_material = { + .effect = &effect_wood, +}; + material const material_lightemit_material = { .effect = &effect_lightemit, }; @@ -973,26 +1333,56 @@ instance_material const instance_materials_node_cube_0[] = { { .element_index = 1, // an index into mesh.triangles .material = &material_material__15_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, { .element_index = 0, // an index into mesh.triangles .material = &material_material__16_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, { .element_index = 5, // an index into mesh.triangles .material = &material_material__17_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, { .element_index = 4, // an index into mesh.triangles .material = &material_material__20_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, { .element_index = 3, // an index into mesh.triangles .material = &material_material__18_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, { .element_index = 2, // an index into mesh.triangles .material = &material_material__19_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, }; @@ -1008,8 +1398,8 @@ instance_light const instance_lights_node_cube[] = { }; channel const * const node_channels_node_cube[] = { - &node_channel_node_cube_translation_y, &node_channel_node_cube_translation_x, + &node_channel_node_cube_translation_y, }; node const node_node_cube = { @@ -1057,6 +1447,11 @@ instance_material const instance_materials_node_torus_0[] = { { .element_index = 0, // an index into mesh.triangles .material = &material_coloreffectr26g177b26_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, }; @@ -1099,7 +1494,12 @@ transform const transforms_node_cylinder[] = { instance_material const instance_materials_node_cylinder_0[] = { { .element_index = 0, // an index into mesh.triangles - .material = &material_coloreffectr229g154b215_material, + .material = &material_grass_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = 0 }, + .specular = { .input_set = -1 }, }, }; @@ -1149,7 +1549,12 @@ transform const transforms_node_plane[] = { instance_material const instance_materials_node_plane_0[] = { { .element_index = 0, // an index into mesh.triangles - .material = &material_coloreffectr28g149b177_material, + .material = &material_wood_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = 0 }, + .specular = { .input_set = 0 }, }, }; @@ -1204,6 +1609,11 @@ instance_material const instance_materials_node_geosphere_0[] = { { .element_index = 0, // an index into mesh.triangles .material = &material_coloreffectr198g224b87_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, }; @@ -1259,6 +1669,9 @@ instance_light const instance_lights_node_light[] = { }; channel const * const node_channels_node_light[] = { + &node_channel_node_light_translation_z, + &node_channel_node_light_translation_x, + &node_channel_node_light_translation_y, }; node const node_node_light = { @@ -1276,7 +1689,7 @@ node const node_node_light = { .instance_lights_count = 1, .channels = node_channels_node_light, - .channels_count = 0, + .channels_count = 3, }; transform const transforms_node_lightindicator[] = { @@ -1290,6 +1703,11 @@ instance_material const instance_materials_node_lightindicator_0[] = { { .element_index = 0, // an index into mesh.triangles .material = &material_lightemit_material, + + .emission = { .input_set = -1 }, + .ambient = { .input_set = -1 }, + .diffuse = { .input_set = -1 }, + .specular = { .input_set = -1 }, }, }; @@ -1351,6 +1769,9 @@ collada::descriptor const descriptor = { .inputs_list = inputs_list, .inputs_list_count = (sizeof (inputs_list)) / (sizeof (inputs_list[0])), + + .images = images, + .images_count = (sizeof (images)) / (sizeof (images[0])), }; }