public ModelSpatialRotationsTestScene() { var scene = new Scene(); scene.Spatials.Add(modelSpatial = new ModelSpatial { Model = Game.ModelStore.Get("Resources/Models/building_dock.obj") }); var sceneViewerContainer = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 100 } }; var sceneViewer = new SceneViewer(scene) { RelativeSizeAxes = Axes.Both }; AddChild(sceneViewerContainer); sceneViewerContainer.AddChild(sceneViewer); sceneViewer.Camera.LookingAt = Vector3.Zero; sceneViewer.Camera.Position = new(0, 0.8f, -0.9f); AddInstructions(); }
public WorldViewer3dTestScene() { // by default, the camera should be at Z = -1, // so (0, 0, 1) rotated by y180 targetYaw = yaw = 180; // look from a bit up targetPitch = pitch = 10; Padding = new Framework.Graphics2d.MarginPadding { Vertical = 50, Horizontal = 50 }; AddChild(sceneViewer = new SceneViewer(scene = new Scene()) { RelativeSizeAxes = Framework.Graphics2d.Axes.Both }); var boxX = Box.FromPositionAndSize(Vector3.UnitX * 3, Vector3.One, new(0.5f)); var boxY = Box.FromPositionAndSize(Vector3.UnitY * 3, Vector3.One, new(0.5f)); var boxZ = Box.FromPositionAndSize(Vector3.UnitZ * 3, Vector3.One, new(0.5f)); var cubeX = new BoxSpatial { Box = boxX, Color = Raylib_cs.Color.RED }; var cubeY = new BoxSpatial { Box = boxY, Color = Raylib_cs.Color.GREEN }; var cubeZ = new BoxSpatial { Box = boxZ, Color = Raylib_cs.Color.BLUE }; var sword = new ModelSpatial { Model = Game.ModelStore.Get("Resources/Models/building_dock.obj"), Scale = new Vector3(4) }; scene.Spatials.AddRange(new Spatial[] { cubeX, cubeY, cubeZ, sword }); sceneViewer.Camera.LookingAt = Vector3.Zero; sceneViewer.Camera.Position = new(0, 1, -5); }