static void SpawnCube(object sender, EventArgs e) { GameObject cube = new GameObject() { Drawable = DrawableMesh.Create(cubeMesh, Shaders.Lit) }; cube.Drawable.Material = cubeMaterial; cube.Transform.Rotate(LudumGL.Random.AngleDeg, LudumGL.Random.AngleDeg, LudumGL.Random.AngleDeg); BoxCollider collider = new BoxCollider(); PhysicsBody body = new PhysicsBody(); cube.AddComponent(collider); cube.AddComponent(body); GameObject.Add(cube); }
static void Initialize() { originDrawable = DrawableMesh.Create(Resources.mesh_origin, Shaders.Unlit); originDrawable.Material.Texture = Resources.texture_origin; camera = new FlyingCamera() { NeedsMouseInput = true }; camera.Camera.Transform = new Transform { localPosition = Vector3.One * 2, localRotation = Quaternion.FromEulerAngles((float)Math.PI / 6f, -(float)Math.PI / 4f, 0) }; gizmoCamera = new Camera { Depth = int.MaxValue }; Game.mainCamera = camera.Camera; gizmoDraw = DrawableMesh.Create(Mesh.Load("assets/mdl/gizmo.dae"), Shaders.Unlit); gizmoDraw.Material.Albedo = new Vector4(0, 1, 0, 1); }
public Panel() : base() { drawables.Add(DrawableMesh.Create(Mesh.Rectangle, Shaders.Unlit)); }