Initializer for a new spatial
This commit is contained in:
parent
f69da37599
commit
393b38499d
@ -151,15 +151,18 @@ function onmousemotion(_, _, relx, rely)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function make_ground()
|
function make_ground()
|
||||||
local ground = couch.TexturedMesh("ground.obj", "grass_lowres.png")
|
local ground_prefab = couch.TexturedMesh("ground.obj", "grass_lowres.png")
|
||||||
ground.transform.position = couch.Vector3(0.0, -2.0, 0.0)
|
ground_prefab.transform.position = couch.Vector3(0.0, -2.0, 0.0)
|
||||||
ground.transform.scale = couch.Vector3(3.0, 1.0, 3.0)
|
ground_prefab.transform.scale = couch.Vector3(3.0, 1.0, 3.0)
|
||||||
|
|
||||||
|
ground = couch.Spatial.new()
|
||||||
|
couch.Node.GetRoot().children:Append(ground)
|
||||||
|
|
||||||
for x = -20, 20, 1 do
|
for x = -20, 20, 1 do
|
||||||
for z = -20, 20, 1 do
|
for z = -20, 20, 1 do
|
||||||
local piece = ground:Duplicate()
|
local piece = ground_prefab:Duplicate()
|
||||||
piece.transform.position = couch.Vector3(3.0 * x, -2.0, 3.0 * z)
|
piece.transform.position = couch.Vector3(3.0 * x, -2.0, 3.0 * z)
|
||||||
couch.Node.GetRoot().children:Append(piece)
|
ground.children:Append(piece)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,6 +40,12 @@ public:
|
|||||||
}
|
}
|
||||||
%ignore "Vector3";
|
%ignore "Vector3";
|
||||||
|
|
||||||
|
%extend Spatial {
|
||||||
|
static Spatial* script_new() {
|
||||||
|
return new Spatial();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
%extend DirectionalLight {
|
%extend DirectionalLight {
|
||||||
static DirectionalLight* script_new() {
|
static DirectionalLight* script_new() {
|
||||||
return new DirectionalLight();
|
return new DirectionalLight();
|
||||||
|
Loading…
Reference in New Issue
Block a user