main: scene node instances

This commit is contained in:
Zack Buhman 2026-02-24 02:03:03 +00:00
parent 64d959ed81
commit 5d1bdfc00f
9 changed files with 846 additions and 57 deletions

View File

@ -144,7 +144,7 @@ mat4 = {
end,
translation_from_vector = function(v)
return translation(v.f[0], v.f[1], v.f[2])
return mat4.translation(v.f[0], v.f[1], v.f[2])
end,
scaling = function(x, y, z)
@ -172,7 +172,7 @@ mat4 = {
end,
scaling_from_vector = function(v)
return scaling(v.f[0], v.f[1], v.f[2])
return mat4.scaling(v.f[0], v.f[1], v.f[2])
end,
rotation_x = function(angle)
@ -806,4 +806,5 @@ return {
scalar = scalar,
mat4 = mat4,
vec3 = vec3,
vec4 = vec4,
}

79
collada_types.lua Normal file
View File

@ -0,0 +1,79 @@
local input_format = {
FLOAT1 = {},
FLOAT2 = {},
FLOAT3 = {},
FLOAT4 = {},
INT1 = {},
INT2 = {},
INT3 = {},
INT4 = {}
}
local light_type = {
AMBIENT = {},
DIRECTIONAL = {},
POINT = {},
SPOT = {}
}
local color_or_texture_type = {
COLOR = {},
TEXTURE = {}
}
local effect_type = {
BLINN = {},
LAMBERT = {},
PHONG = {},
CONSTANT = {}
}
local transform_type = {
LOOKAT = {},
MATRIX = {},
ROTATE = {},
SCALE = {},
SKEW = {},
TRANSLATE = {}
}
local node_type = {
JOINT = {},
NODE = {}
}
local interpolation = {
LINEAR = {},
BEZIER = {}
}
local target_attribute = {
A = {}, -- alpha color component
ANGLE = {}, -- euler angle
B = {}, -- blue color component
G = {}, -- green color component
P = {}, -- third texture component
Q = {}, -- fourth texture component
R = {}, -- red color component
S = {}, -- first texture coordinate
T = {}, -- second texture coordinate
TIME = {}, -- time in seconds
U = {}, -- first generic parameter
V = {}, -- second generic parameter
W = {}, -- fourth cartesian coordinate
X = {}, -- first cartesian coordinate
Y = {}, -- second cartesian coordinate
Z = {}, -- third cartesian coordinate
ALL = {}
}
return {
input_format = input_format,
light_type = light_type,
color_or_texture_type = color_or_texture_type,
effect_type = effect_type,
transform_type = transform_type,
node_type = node_type,
interpolation = interpolation,
target_attribute = target_attribute,
}

203
main.lua
View File

@ -1,4 +1,3 @@
local mesh
local rotation
local texture
@ -6,12 +5,17 @@ local ffi = require 'ffi'
local _math = require '_math'
local mat4 = _math.mat4
local vec3 = _math.vec3
local vec4 = _math.vec4
local scalar = _math.scalar
local scene_test = require 'scene.test.test'
local collada_types = require 'collada_types'
local pixelcode = [[
#pragma language glsl3
varying vec4 PixelNormal;
varying vec4 PixelTexture;
varying float PixelId;
uniform sampler2D texture_sampler;
@ -37,11 +41,13 @@ local vertexcode = [[
varying vec4 PixelNormal;
varying vec4 PixelTexture;
varying float PixelId;
void vertexmain()
{
PixelNormal = VertexNormal * 0.5 + 0.5;
PixelTexture = VertexTexture;
PixelId = float(gl_VertexID) / (4800 * 3);
love_Position = transform * vec4(VertexPosition.xyz, 1);
}
]]
@ -54,50 +60,148 @@ local vertexformat = {
{ name = 'VertexTexture', format = 'floatvec3', location = 2 },
}
function pnt_attribute_list(vertex_buffer, offset)
return {
{
buffer = vertex_buffer,
location = 0,
name = "VertexPosition",
nameinbuffer = nil,
step = "pervertex",
startindex = 1 + offset,
},
{
buffer = vertex_buffer,
location = 1,
name = "VertexNormal",
nameinbuffer = nil,
step = "pervertex",
startindex = 1 + offset,
},
{
buffer = vertex_buffer,
location = 2,
name = "VertexTexture",
nameinbuffer = nil,
step = "pervertex",
startindex = 1 + offset,
},
}
end
local geometries_meshes = {}
function load_geometries(vertex_buffer, index_buffer, geometries)
for _, geometry in ipairs(geometries) do
local offset = geometry.mesh.vertex_buffer_offset / (4 * 3 * 3)
local attribute_list = pnt_attribute_list(vertex_buffer, offset)
local draw_mode = "triangles"
local mesh = love.graphics.newMesh(attribute_list, draw_mode)
mesh:setIndexBuffer(index_buffer)
geometries_meshes[geometry] = mesh
end
end
local node_instances = {}
function node_world_transform(node)
local world
if node.parent_index >= 0 then
world = node_instances[node.parent_index].world
assert(world ~= nil)
else
world = mat4.identity()
end
for _, transform in ipairs(node.transforms) do
local m
if transform.type == collada_types.transform_type.LOOKAT then
assert(false)
elseif transform.type == collada_types.transform_type.MATRIX then
m = mat4.load_table(transform.matrix)
elseif transform.type == collada_types.transform_type.ROTATE then
local rotate = vec4.load_table(transform.rotate)
local w = rotate.f[3]
m = mat4.rotation_axis(rotate, scalar.convert_to_radians(w))
elseif transform.type == collada_types.transform_type.SCALE then
m = mat4.scaling_from_vector(vec3.load_table(transform.scale))
elseif transform.type == collada_types.transform_type.TRANSLATE then
m = mat4.translation_from_vector(vec3.load_table(transform.translate))
else
assert(false)
end
world = m * world
end
return world
end
function load_node_world_transforms(nodes)
local node_index = 0
for _, node in ipairs(nodes) do
world = node_world_transform(node)
node_instances[node_index] = { world = world }
node_index = node_index + 1
end
end
function love.load(args)
love.window.setMode(1024, 1024, {depth=true})
local vertexdata = love.filesystem.newFileData("position_normal_texture.vtx")
local indexdata = love.filesystem.newFileData("index.idx")
local vertex_data = love.filesystem.newFileData("scene/test/test.vtx")
local index_data = love.filesystem.newFileData("scene/test/test.idx")
local vertexbuffer = love.graphics.newBuffer(vertexformat, vertexdata, { vertex = true, usage = "static" })
local indexbuffer = love.graphics.newBuffer("uint32", indexdata, { index = true, usage = "static" })
local vertex_buffer = love.graphics.newBuffer(vertexformat, vertex_data, { vertex = true, usage = "static" })
local index_buffer = love.graphics.newBuffer("uint32", index_data, { index = true, usage = "static" })
attributelist = {
{
buffer = vertexbuffer,
location = 0,
name = "VertexPosition", -- the name this vertex attribute will use in a shader
nameinbuffer = nil, -- the name of the attribute in the vertex buffer. Defaults to the name field.
step = "pervertex", -- vertex attribute step ("pervertex" or "perinstance"), defaults to "pervertex".
startindex = 1, -- 1-based array index within the given vertex buffer where the attribute data will start being pulled from during rendering. Defaults to 1.
},
{
buffer = vertexbuffer,
location = 1,
name = "VertexNormal", -- the name this vertex attribute will use in a shader
nameinbuffer = nil, -- the name of the attribute in the vertex buffer. Defaults to the name field.
step = "pervertex", -- vertex attribute step ("pervertex" or "perinstance"), defaults to "pervertex".
startindex = 1, -- 1-based array index within the given vertex buffer where the attribute data will start being pulled from during rendering. Defaults to 1.
},
{
buffer = vertexbuffer,
location = 2,
name = "VertexTexture", -- the name this vertex attribute will use in a shader
nameinbuffer = nil, -- the name of the attribute in the vertex buffer. Defaults to the name field.
step = "pervertex", -- vertex attribute step ("pervertex" or "perinstance"), defaults to "pervertex".
startindex = 1, -- 1-based array index within the given vertex buffer where the attribute data will start being pulled from during rendering. Defaults to 1.
},
}
drawmode = "triangles"
mesh = love.graphics.newMesh(attributelist, drawmode)
mesh:setIndexBuffer(indexbuffer)
load_geometries(vertex_buffer, index_buffer, scene_test.descriptor.geometries)
load_node_world_transforms(scene_test.descriptor.nodes)
local image_data = love.image.newCompressedData('bird.dds')
texture = love.graphics.newTexture(image_data)
end
function draw_geometry(geometry)
local base_index_buffer_offset = geometry.mesh.index_buffer_offset / 4
local mesh = geometries_meshes[geometry]
for triangle_index, triangles in pairs(geometry.mesh.triangles) do
local index_offset = base_index_buffer_offset + triangles.index_offset
local index_count = triangles.count * 3
mesh:setDrawRange(1 + index_offset, index_count)
love.graphics.draw(mesh, 0, 0, 0, 0, 0)
end
end
function draw_node(node_index, node, transform)
if node.type ~= collada_types.node_type.NODE then
return
end
if node.instance_geometries_count == 0 and node.instance_controllers_count == 0 then
return
end
local world = node_instances[node_index].world
transform = world * transform
shader:send("transform", "column", transform.data)
for _, instance_geometry in ipairs(node.instance_geometries) do
draw_geometry(instance_geometry.geometry)
end
end
function draw_nodes(nodes, transform)
local node_index = 0
for _, node in ipairs(nodes) do
draw_node(node_index, node, transform)
node_index = node_index + 1
end
end
local rotation = 0.0
function love.draw()
@ -105,36 +209,27 @@ function love.draw()
local mx, my = love.mouse.getPosition()
width, height = love.graphics.getDimensions()
-- shader:send("projection", "column", mat4.perspective_rh(width / width * 0.25,
-- height / width * 0.25,
-- 0.1,
-- 1000.0).data)
-- shader:send("view", "column", mat4.look_at_rh(vec3(0, -2, 0),
-- vec3(0, 0, 0),
-- vec3(0, 0, 1)).data)
-- shader:send("model", "column", mat4.rotation_x(rotation).data)
-- shader:send("model2", "column", mat4.rotation_z(rotation * 0.5).data)
local projection = mat4.perspective_rh(width / width * 0.25,
height / width * 0.25,
local projection = mat4.perspective_rh(width / width * 0.1,
height / width * 0.1,
0.1,
1000.0)
local view = mat4.look_at_rh(vec3(0, -2, 0),
vec3(0, 0, 0),
local view = mat4.look_at_rh(vec3(-88.57101, -71.71298, 104.5738),
vec3(-19.90239, -27.72767, 54.6898),
vec3(0, 0, 1))
local world1 = mat4.rotation_x(rotation)
local world2 = mat4.rotation_z(rotation * 0.5)
local world3 = mat4.translation(0, 0, -0.5)
--local world3 = mat4.translation(0, 0, -0.5)
local transform = world3 * world2 * world1 * view * projection
shader:send("transform", "column", transform.data)
local transform = view * projection
shader:send("texture_sampler", texture)
rotation = rotation + 0.01
love.graphics.setShader(shader)
love.graphics.setDepthMode("less", true)
love.graphics.draw(mesh, mx, my, 0, radius, radius)
draw_nodes(scene_test.descriptor.nodes, transform)
end

BIN
scene/test/test.idx Normal file

Binary file not shown.

610
scene/test/test.lua Normal file
View File

@ -0,0 +1,610 @@
local collada_types = require 'collada_types'
local camera_camera_camera = {
xfov = 45.0,
yfov = 0.0,
znear = 1.0,
zfar = 1000.0,
aspect_ratio = 0.0,
}
local light_environmentambientlight = {
type = collada_types.light_type.AMBIENT,
color = {0.0, 0.0, 0.0},
}
local images = {
}
local effect_coloreffectr228g184b153 = {
type = collada_types.effect_type.PHONG,
phong = {
emission = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.0, 0.0, 0.0, 0.0},
},
ambient = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.8941176, 0.7215686, 0.6, 1.0},
},
diffuse = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.8941176, 0.7215686, 0.6, 1.0},
},
specular = {
type = collada_types.color_or_texture_type.COLOR,
color = {1.0, 1.0, 1.0, 1.0},
},
shininess = 10.0,
reflective = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.0, 0.0, 0.0, 1.0},
},
reflectivity = 0.0,
transparent = {
type = collada_types.color_or_texture_type.COLOR,
color = {1.0, 1.0, 1.0, 1.0},
},
transparency = 1.0,
index_of_refraction = 0.0,
}
}
local effect_coloreffectr153g228b184 = {
type = collada_types.effect_type.PHONG,
phong = {
emission = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.0, 0.0, 0.0, 0.0},
},
ambient = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.6, 0.8941176, 0.7215686, 1.0},
},
diffuse = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.6, 0.8941176, 0.7215686, 1.0},
},
specular = {
type = collada_types.color_or_texture_type.COLOR,
color = {1.0, 1.0, 1.0, 1.0},
},
shininess = 10.0,
reflective = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.0, 0.0, 0.0, 1.0},
},
reflectivity = 0.0,
transparent = {
type = collada_types.color_or_texture_type.COLOR,
color = {1.0, 1.0, 1.0, 1.0},
},
transparency = 1.0,
index_of_refraction = 0.0,
}
}
local effect_coloreffectr177g26b88 = {
type = collada_types.effect_type.PHONG,
phong = {
emission = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.0, 0.0, 0.0, 0.0},
},
ambient = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.6941176, 0.1019608, 0.345098, 1.0},
},
diffuse = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.6941176, 0.1019608, 0.345098, 1.0},
},
specular = {
type = collada_types.color_or_texture_type.COLOR,
color = {1.0, 1.0, 1.0, 1.0},
},
shininess = 10.0,
reflective = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.0, 0.0, 0.0, 1.0},
},
reflectivity = 0.0,
transparent = {
type = collada_types.color_or_texture_type.COLOR,
color = {1.0, 1.0, 1.0, 1.0},
},
transparency = 1.0,
index_of_refraction = 0.0,
}
}
local effect_coloreffectr5g54b179 = {
type = collada_types.effect_type.PHONG,
phong = {
emission = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.0, 0.0, 0.0, 0.0},
},
ambient = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.01960784, 0.2117647, 0.7019608, 1.0},
},
diffuse = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.01960784, 0.2117647, 0.7019608, 1.0},
},
specular = {
type = collada_types.color_or_texture_type.COLOR,
color = {1.0, 1.0, 1.0, 1.0},
},
shininess = 10.0,
reflective = {
type = collada_types.color_or_texture_type.COLOR,
color = {0.0, 0.0, 0.0, 1.0},
},
reflectivity = 0.0,
transparent = {
type = collada_types.color_or_texture_type.COLOR,
color = {1.0, 1.0, 1.0, 1.0},
},
transparency = 1.0,
index_of_refraction = 0.0,
}
}
local material_coloreffectr228g184b153_material = {
effect = effect_coloreffectr228g184b153,
}
local material_coloreffectr153g228b184_material = {
effect = effect_coloreffectr153g228b184,
}
local material_coloreffectr177g26b88_material = {
effect = effect_coloreffectr177g26b88,
}
local material_coloreffectr5g54b179_material = {
effect = effect_coloreffectr5g54b179,
}
local input_elements_position_0_3_normal_0_3_texcoord_0_3 = {
{
semantic = "POSITION",
semantic_index = 0,
format = collada_types.input_format.FLOAT3,
},
{
semantic = "NORMAL",
semantic_index = 0,
format = collada_types.input_format.FLOAT3,
},
{
semantic = "TEXCOORD",
semantic_index = 0,
format = collada_types.input_format.FLOAT3,
},
}
local triangles_geom_plane = {
{
count = 20000, -- triangles
index_offset = 0, -- indices
inputs_index = 0, -- index into inputs_list
},
}
local geometry_geom_plane = {
mesh = {
triangles = triangles_geom_plane,
triangles_count = 1,
vertex_buffer_offset = 0,
vertex_buffer_size = 367236,
index_buffer_offset = 0,
index_buffer_size = 240000,
}
}
local triangles_geom_torus_knot23 = {
{
count = 4800, -- triangles
index_offset = 0, -- indices
inputs_index = 0, -- index into inputs_list
},
}
local geometry_geom_torus_knot23 = {
mesh = {
triangles = triangles_geom_torus_knot23,
triangles_count = 1,
vertex_buffer_offset = 367236,
vertex_buffer_size = 94068,
index_buffer_offset = 240000,
index_buffer_size = 57600,
}
}
local triangles_geom_torusknot25 = {
{
count = 2400, -- triangles
index_offset = 0, -- indices
inputs_index = 0, -- index into inputs_list
},
}
local geometry_geom_torusknot25 = {
mesh = {
triangles = triangles_geom_torusknot25,
triangles_count = 1,
vertex_buffer_offset = 461304,
vertex_buffer_size = 86832,
index_buffer_offset = 297600,
index_buffer_size = 28800,
}
}
local geometries = {
geometry_geom_plane,
geometry_geom_torus_knot23,
geometry_geom_torusknot25,
}
local transforms_node_environmentambientlight = {
}
local instance_geometries_node_environmentambientlight = {
}
local instance_controllers_node_environmentambientlight = {
}
local instance_lights_node_environmentambientlight = {
{
light = light_environmentambientlight,
}
}
local node_channels_node_environmentambientlight = {
}
local node_node_environmentambientlight = {
parent_index = -1,
type = collada_types.node_type.NODE,
transforms = transforms_node_environmentambientlight,
transforms_count = 0,
instance_geometries = instance_geometries_node_environmentambientlight,
instance_geometries_count = 0,
instance_controllers = instance_controllers_node_environmentambientlight,
instance_controllers_count = 0,
instance_lights = instance_lights_node_environmentambientlight,
instance_lights_count = 1,
channels = node_channels_node_environmentambientlight,
channels_count = 0,
}
local transforms_node_plane = {
}
local instance_geometry_instance_materials_node_plane_0 = {
{
element_index = 0, -- an index into mesh.triangles
material = material_coloreffectr228g184b153_material,
emission = { input_set = -1 },
ambient = { input_set = -1 },
diffuse = { input_set = -1 },
specular = { input_set = -1 },
},
}
local instance_geometries_node_plane = {
{
geometry = geometry_geom_plane,
instance_materials = instance_geometry_instance_materials_node_plane_0,
instance_materials_count = 1,
},
}
local instance_controllers_node_plane = {
}
local instance_lights_node_plane = {
}
local node_channels_node_plane = {
}
local node_node_plane = {
parent_index = -1,
type = collada_types.node_type.NODE,
transforms = transforms_node_plane,
transforms_count = 0,
instance_geometries = instance_geometries_node_plane,
instance_geometries_count = 1,
instance_controllers = instance_controllers_node_plane,
instance_controllers_count = 0,
instance_lights = instance_lights_node_plane,
instance_lights_count = 0,
channels = node_channels_node_plane,
channels_count = 0,
}
local transforms_node_torus_knot23 = {
{
type = collada_types.transform_type.TRANSLATE,
translate = {-21.94384, -1.68812e-14, 45.45129},
},
{
type = collada_types.transform_type.ROTATE,
rotate = {-1.0, -2.22051e-16, -2.22051e-16, -90.0},
},
{
type = collada_types.transform_type.SCALE,
scale = {0.5458366, 0.5458366, 0.5458366},
},
}
local instance_geometry_instance_materials_node_torus_knot23_0 = {
{
element_index = 0, -- an index into mesh.triangles
material = material_coloreffectr153g228b184_material,
emission = { input_set = -1 },
ambient = { input_set = -1 },
diffuse = { input_set = -1 },
specular = { input_set = -1 },
},
}
local instance_geometries_node_torus_knot23 = {
{
geometry = geometry_geom_torus_knot23,
instance_materials = instance_geometry_instance_materials_node_torus_knot23_0,
instance_materials_count = 1,
},
}
local instance_controllers_node_torus_knot23 = {
}
local instance_lights_node_torus_knot23 = {
}
local node_channels_node_torus_knot23 = {
}
local node_node_torus_knot23 = {
parent_index = -1,
type = collada_types.node_type.NODE,
transforms = transforms_node_torus_knot23,
transforms_count = 3,
instance_geometries = instance_geometries_node_torus_knot23,
instance_geometries_count = 1,
instance_controllers = instance_controllers_node_torus_knot23,
instance_controllers_count = 0,
instance_lights = instance_lights_node_torus_knot23,
instance_lights_count = 0,
channels = node_channels_node_torus_knot23,
channels_count = 0,
}
local transforms_node_torusknot25 = {
{
type = collada_types.transform_type.TRANSLATE,
translate = {3.281013, -28.30101, 45.45129},
},
{
type = collada_types.transform_type.ROTATE,
rotate = {0.9075136, -0.007434183, 0.4199569, -178.1592},
},
{
type = collada_types.transform_type.ROTATE,
rotate = {0.9893375, 0.0, 0.1456411, -1.382112},
},
{
type = collada_types.transform_type.SCALE,
scale = {0.5458366, 0.5458367, 0.5458366},
},
{
type = collada_types.transform_type.ROTATE,
rotate = {0.9893375, 0.0, 0.1456411, 1.382112},
},
}
local instance_geometry_instance_materials_node_torusknot25_0 = {
{
element_index = 0, -- an index into mesh.triangles
material = material_coloreffectr177g26b88_material,
emission = { input_set = -1 },
ambient = { input_set = -1 },
diffuse = { input_set = -1 },
specular = { input_set = -1 },
},
}
local instance_geometries_node_torusknot25 = {
{
geometry = geometry_geom_torusknot25,
instance_materials = instance_geometry_instance_materials_node_torusknot25_0,
instance_materials_count = 1,
},
}
local instance_controllers_node_torusknot25 = {
}
local instance_lights_node_torusknot25 = {
}
local node_channels_node_torusknot25 = {
}
local node_node_torusknot25 = {
parent_index = -1,
type = collada_types.node_type.NODE,
transforms = transforms_node_torusknot25,
transforms_count = 5,
instance_geometries = instance_geometries_node_torusknot25,
instance_geometries_count = 1,
instance_controllers = instance_controllers_node_torusknot25,
instance_controllers_count = 0,
instance_lights = instance_lights_node_torusknot25,
instance_lights_count = 0,
channels = node_channels_node_torusknot25,
channels_count = 0,
}
local transforms_node_camerahelper = {
{
type = collada_types.transform_type.TRANSLATE,
translate = {-88.57101, -71.71298, 104.5738},
},
}
local instance_geometries_node_camerahelper = {
}
local instance_controllers_node_camerahelper = {
}
local instance_lights_node_camerahelper = {
}
local node_channels_node_camerahelper = {
}
local node_node_camerahelper = {
parent_index = -1,
type = collada_types.node_type.NODE,
transforms = transforms_node_camerahelper,
transforms_count = 1,
instance_geometries = instance_geometries_node_camerahelper,
instance_geometries_count = 0,
instance_controllers = instance_controllers_node_camerahelper,
instance_controllers_count = 0,
instance_lights = instance_lights_node_camerahelper,
instance_lights_count = 0,
channels = node_channels_node_camerahelper,
channels_count = 0,
}
local transforms_node_camera = {
{
type = collada_types.transform_type.MATRIX,
matrix = {0.5124585, -0.8587118, -3.72529e-08, 0.0, 0.4546754, 0.2713395, 0.848319, 0.0, -0.7284616, -0.4347285, 0.5294855, 0.0, -5.03627, 0.0, 3.688698, 1.0},
},
}
local instance_geometries_node_camera = {
}
local instance_controllers_node_camera = {
}
local instance_lights_node_camera = {
}
local node_channels_node_camera = {
}
local node_node_camera = {
parent_index = 4,
type = collada_types.node_type.NODE,
transforms = transforms_node_camera,
transforms_count = 1,
instance_geometries = instance_geometries_node_camera,
instance_geometries_count = 0,
instance_controllers = instance_controllers_node_camera,
instance_controllers_count = 0,
instance_lights = instance_lights_node_camera,
instance_lights_count = 0,
channels = node_channels_node_camera,
channels_count = 0,
}
local transforms_node_cameratargethelper = {
{
type = collada_types.transform_type.TRANSLATE,
translate = {-19.90239, -27.72767, 54.6898},
},
}
local instance_geometries_node_cameratargethelper = {
}
local instance_controllers_node_cameratargethelper = {
}
local instance_lights_node_cameratargethelper = {
}
local node_channels_node_cameratargethelper = {
}
local node_node_cameratargethelper = {
parent_index = -1,
type = collada_types.node_type.NODE,
transforms = transforms_node_cameratargethelper,
transforms_count = 1,
instance_geometries = instance_geometries_node_cameratargethelper,
instance_geometries_count = 0,
instance_controllers = instance_controllers_node_cameratargethelper,
instance_controllers_count = 0,
instance_lights = instance_lights_node_cameratargethelper,
instance_lights_count = 0,
channels = node_channels_node_cameratargethelper,
channels_count = 0,
}
local transforms_node_camera_target = {
}
local instance_geometries_node_camera_target = {
}
local instance_controllers_node_camera_target = {
}
local instance_lights_node_camera_target = {
}
local node_channels_node_camera_target = {
}
local node_node_camera_target = {
parent_index = 6,
type = collada_types.node_type.NODE,
transforms = transforms_node_camera_target,
transforms_count = 0,
instance_geometries = instance_geometries_node_camera_target,
instance_geometries_count = 0,
instance_controllers = instance_controllers_node_camera_target,
instance_controllers_count = 0,
instance_lights = instance_lights_node_camera_target,
instance_lights_count = 0,
channels = node_channels_node_camera_target,
channels_count = 0,
}
local nodes = {
node_node_environmentambientlight, -- 0
node_node_plane, -- 1
node_node_torus_knot23, -- 2
node_node_torusknot25, -- 3
node_node_camerahelper, -- 4
node_node_camera, -- 5
node_node_cameratargethelper, -- 6
node_node_camera_target, -- 7
}
local inputs_list = {
{
elements = input_elements_position_0_3_normal_0_3_texcoord_0_3,
elements_count = 3,
},
}
local descriptor = {
nodes = nodes,
nodes_count = #nodes,
geometries = geometries,
nodes_count = #geometries,
inputs_list = inputs_list,
inputs_list_count = #inputs_list,
images = images,
images_count = #images,
}
return {
descriptor = descriptor
}

0
scene/test/test.mk Normal file
View File

4
scene/test/test.rc Normal file
View File

@ -0,0 +1,4 @@
RES_SCENES_TEST_VTX RCDATA "test.vtx"
RES_SCENES_TEST_VJW RCDATA "test.vjw"
RES_SCENES_TEST_IDX RCDATA "test.idx"

0
scene/test/test.vjw Normal file
View File

BIN
scene/test/test.vtx Normal file

Binary file not shown.