Example #1
0
        public override void Awake()
        {
            base.Awake();

            CoreEngine.input.AddKeyMap("Quit", Key.Escape);
            quitMap = CoreEngine.input.Mapping("Quit");

            MeshRenderer mr = new MeshRenderer(ModelLoader.LoadModel("Content/Models/duck.dae"), new Material(TextureLoader.LoadTexture("Content/Models/duckCM.bmp")));

            duckObject = new GameObject();
            duckObject.AddComponent(new MeshRenderer(ModelLoader.LoadModel("Content/Models/duck.dae"), new Material(TextureLoader.LoadTexture("Content/Models/duckCM.bmp"))));
            duckObject.Transform.Scale = new Vector3(0.015f);
            duckObject.Transform.Position = new Vector3(0, 0, 0);

            Root.AddChild(duckObject);

            cameraObject = new GameObject();
            cameraObject.AddComponent(new Camera(Matrix4.CreatePerspectiveFieldOfView((float)MathHelper.DegreesToRadians(90), (float)CoreEngine.Width / (float)CoreEngine.Height, 0.3f, 1000f)));
            cameraObject.AddComponent(new FreeMove(10));
            cameraObject.AddComponent(new FreeLook(1));
            Root.AddChild(cameraObject);
            cameraObject.Transform.Position = new Vector3(0, 0, -15);
        }
Example #2
0
 public void AddChild(GameObject child)
 {
     children.Add(child);
     child.AddToEngine();
     child.Transform.SetParent(transform);
 }
Example #3
0
 public void Render(GameObject gameObject)
 {
     GraphicsUtil.ClearScreen();
     GL.Viewport(CoreEngine.window.ClientRectangle);
     gameObject.Render(basicShader);
 }