Esempio n. 1
0
        public void DrawDebugInfo(Camera camera)
        {
            var count = 0;
            foreach (RigidBody body in PhysicsWorld.RigidBodies)
            {
                DebugDrawer.Color = DebugColors[count % DebugColors.Length];
                DebugDrawer.ClockWise = body.Shape is TriangleMeshShape;
                body.DebugDraw(DebugDrawer);
                count++;
            }

            DebugDrawer.Render(camera);
        }
Esempio n. 2
0
        public void Render(Camera camera)
        {
            if (Params == null)
            {
                Params = new ShaderParams();
                Shader.GetUniformLocations(Params);
            }

            Matrix4 viewMatrix;
            camera.GetViewMatrix(out viewMatrix);

            Matrix4 projectionMatrix;
            camera.GetProjectionMatrix(out projectionMatrix);

            var modelViewProjectionMatrix = viewMatrix * projectionMatrix;

            Batch.End();

            Backend.BeginInstance(Shader.Handle, new int[0], null, RenderStateId);

            Backend.BindShaderVariable(Params.HandleModelViewProjection, ref modelViewProjectionMatrix);
            Backend.BindShaderVariable(Params.HandleColor, ref Color);

            Backend.DrawMesh(Batch.MeshHandle);
            Backend.EndInstance();

            TriangleIndex = 0;
            Batch.Begin();
        }