|
@@ -257,32 +257,32 @@ function UnitBox:destroy()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:local_position()
|
|
function UnitBox:local_position()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.local_position(self._sg, tr) or Vector3.zero()
|
|
return tr and SceneGraph.local_position(self._sg, tr) or Vector3.zero()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:local_rotation()
|
|
function UnitBox:local_rotation()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.local_rotation(self._sg, tr) or Quaternion.identity()
|
|
return tr and SceneGraph.local_rotation(self._sg, tr) or Quaternion.identity()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:local_scale()
|
|
function UnitBox:local_scale()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.local_scale(self._sg, tr) or Vector3(1, 1, 1)
|
|
return tr and SceneGraph.local_scale(self._sg, tr) or Vector3(1, 1, 1)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:local_pose()
|
|
function UnitBox:local_pose()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.local_pose(self._sg, tr) or Matrix4x4.identity()
|
|
return tr and SceneGraph.local_pose(self._sg, tr) or Matrix4x4.identity()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:world_position()
|
|
function UnitBox:world_position()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.world_position(self._sg, tr) or Vector3.zero()
|
|
return tr and SceneGraph.world_position(self._sg, tr) or Vector3.zero()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:world_rotation()
|
|
function UnitBox:world_rotation()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.world_rotation(self._sg, tr) or Quaternion.identity()
|
|
return tr and SceneGraph.world_rotation(self._sg, tr) or Quaternion.identity()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -291,27 +291,27 @@ function UnitBox:world_scale()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:world_pose()
|
|
function UnitBox:world_pose()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.world_pose(self._sg, tr) or Matrix4x4.identity()
|
|
return tr and SceneGraph.world_pose(self._sg, tr) or Matrix4x4.identity()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:set_local_position(pos)
|
|
function UnitBox:set_local_position(pos)
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
if tr then SceneGraph.set_local_position(self._sg, tr, pos) end
|
|
if tr then SceneGraph.set_local_position(self._sg, tr, pos) end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:set_local_rotation(rot)
|
|
function UnitBox:set_local_rotation(rot)
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
if tr then SceneGraph.set_local_rotation(self._sg, tr, rot) end
|
|
if tr then SceneGraph.set_local_rotation(self._sg, tr, rot) end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:set_local_scale(scale)
|
|
function UnitBox:set_local_scale(scale)
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
if tr then SceneGraph.set_local_scale(self._sg, tr, scale) end
|
|
if tr then SceneGraph.set_local_scale(self._sg, tr, scale) end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function UnitBox:set_local_pose(pose)
|
|
function UnitBox:set_local_pose(pose)
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
if tr then SceneGraph.set_local_pose(self._sg, tr, pose) end
|
|
if tr then SceneGraph.set_local_pose(self._sg, tr, pose) end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -380,32 +380,32 @@ function SoundObject:name()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:local_position()
|
|
function SoundObject:local_position()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.local_position(self._sg, tr) or Vector3.zero()
|
|
return tr and SceneGraph.local_position(self._sg, tr) or Vector3.zero()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:local_rotation()
|
|
function SoundObject:local_rotation()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.local_rotation(self._sg, tr) or Quaternion.identity()
|
|
return tr and SceneGraph.local_rotation(self._sg, tr) or Quaternion.identity()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:local_scale()
|
|
function SoundObject:local_scale()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.local_scale(self._sg, tr) or Vector3(1, 1, 1)
|
|
return tr and SceneGraph.local_scale(self._sg, tr) or Vector3(1, 1, 1)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:local_pose()
|
|
function SoundObject:local_pose()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.local_pose(self._sg, tr) or Matrix4x4.identity()
|
|
return tr and SceneGraph.local_pose(self._sg, tr) or Matrix4x4.identity()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:world_position()
|
|
function SoundObject:world_position()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.world_position(self._sg, tr) or Vector3.zero()
|
|
return tr and SceneGraph.world_position(self._sg, tr) or Vector3.zero()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:world_rotation()
|
|
function SoundObject:world_rotation()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.world_rotation(self._sg, tr) or Quaternion.identity()
|
|
return tr and SceneGraph.world_rotation(self._sg, tr) or Quaternion.identity()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -414,27 +414,27 @@ function SoundObject:world_scale()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:world_pose()
|
|
function SoundObject:world_pose()
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
return tr and SceneGraph.world_pose(self._sg, tr) or Matrix4x4.identity()
|
|
return tr and SceneGraph.world_pose(self._sg, tr) or Matrix4x4.identity()
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:set_local_position(pos)
|
|
function SoundObject:set_local_position(pos)
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
if tr then SceneGraph.set_local_position(self._sg, tr, pos) end
|
|
if tr then SceneGraph.set_local_position(self._sg, tr, pos) end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:set_local_rotation(rot)
|
|
function SoundObject:set_local_rotation(rot)
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
if tr then SceneGraph.set_local_rotation(self._sg, tr, rot) end
|
|
if tr then SceneGraph.set_local_rotation(self._sg, tr, rot) end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:set_local_scale(scale)
|
|
function SoundObject:set_local_scale(scale)
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
if tr then SceneGraph.set_local_scale(self._sg, tr, scale) end
|
|
if tr then SceneGraph.set_local_scale(self._sg, tr, scale) end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function SoundObject:set_local_pose(pose)
|
|
function SoundObject:set_local_pose(pose)
|
|
|
- local tr = SceneGraph.transform_instances(self._sg, self._unit_id)
|
|
|
|
|
|
|
+ local tr = SceneGraph.instances(self._sg, self._unit_id)
|
|
|
if tr then SceneGraph.set_local_pose(self._sg, tr, pose) end
|
|
if tr then SceneGraph.set_local_pose(self._sg, tr, pose) end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
@@ -1287,7 +1287,7 @@ function LevelEditor:init()
|
|
|
self.tool = self.place_tool
|
|
self.tool = self.place_tool
|
|
|
|
|
|
|
|
-- Spawn camera
|
|
-- Spawn camera
|
|
|
- local camera_transform = SceneGraph.transform_instances(self._sg, self._fpscamera:unit())
|
|
|
|
|
|
|
+ local camera_transform = SceneGraph.instances(self._sg, self._fpscamera:unit())
|
|
|
local pos = Vector3(20, 20, -20)
|
|
local pos = Vector3(20, 20, -20)
|
|
|
local dir = Vector3.normalize(Vector3.zero() - pos)
|
|
local dir = Vector3.normalize(Vector3.zero() - pos)
|
|
|
SceneGraph.set_local_rotation(self._sg, camera_transform, Quaternion.look(dir))
|
|
SceneGraph.set_local_rotation(self._sg, camera_transform, Quaternion.look(dir))
|