瀏覽代碼

samples: core: cleanup

Daniele Bartolini 1 年之前
父節點
當前提交
045e81ad32
共有 2 個文件被更改,包括 7 次插入7 次删除
  1. 1 1
      samples/core/editors/level_editor/camera.lua
  2. 6 6
      samples/core/editors/level_editor/level_editor.lua

+ 1 - 1
samples/core/editors/level_editor/camera.lua

@@ -174,7 +174,7 @@ function Camera:set_perspective()
 	self:send_state()
 end
 
-function Camera:set_orthographic(world_center, world_radius, dir, up)
+function Camera:set_orthographic(dir, up)
 	local camera = self:camera()
 	local tr = SceneGraph.instance(self._sg, self._unit)
 

+ 6 - 6
samples/core/editors/level_editor/level_editor.lua

@@ -1799,27 +1799,27 @@ function LevelEditor:camera_view_perspective()
 end
 
 function LevelEditor:camera_view_front()
-	self._camera:set_orthographic(Vector3(0, 0, 0), Vector3(1, 1, 1), Vector3(0, 0, 1), Vector3(0, 1, 0))
+	self._camera:set_orthographic(Vector3.forward(), Vector3.up())
 end
 
 function LevelEditor:camera_view_back()
-	self._camera:set_orthographic(Vector3(0, 0, 0), Vector3(1, 1, 1), Vector3(0, 0, -1), Vector3(0, 1, 0))
+	self._camera:set_orthographic(Vector3.backward(), Vector3.up())
 end
 
 function LevelEditor:camera_view_right()
-	self._camera:set_orthographic(Vector3(0, 0, 0), Vector3(1, 1, 1), Vector3(-1, 0, 0), Vector3(0, 1, 0))
+	self._camera:set_orthographic(Vector3.left(), Vector3.up())
 end
 
 function LevelEditor:camera_view_left()
-	self._camera:set_orthographic(Vector3(0, 0, 0), Vector3(1, 1, 1), Vector3(1, 0, 0), Vector3(0, 1, 0))
+	self._camera:set_orthographic(Vector3.right(), Vector3.up())
 end
 
 function LevelEditor:camera_view_top()
-	self._camera:set_orthographic(Vector3(0, 0, 0), Vector3(1, 1, 1), Vector3(0, -1, 0), Vector3(0, 0, 1))
+	self._camera:set_orthographic(Vector3.down(), Vector3.forward())
 end
 
 function LevelEditor:camera_view_bottom()
-	self._camera:set_orthographic(Vector3(0, 0, 0), Vector3(1, 1, 1), Vector3(0, 1, 0), Vector3(0, 0, 1))
+	self._camera:set_orthographic(Vector3.up(), Vector3.forward())
 end
 
 function LevelEditor:camera_drag_start(mode)