getVertices() public méthode

public getVertices ( ) : CustomVertex.PositionNormalColored[]
Résultat CustomVertex.PositionNormalColored[]
Exemple #1
0
        private void Render()
        {
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.White, 1.0f, 0);
            device.BeginScene();

            float x = (float)Math.Cos(rot);
            float z = (float)Math.Sin(rot);

            device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4, this.Width / this.Height, 1f, 50f);
            device.Transform.View       = Matrix.LookAtLH(new Vector3(x, 6, z), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
            device.RenderState.Lighting = true;
            device.Lights[0].Type       = LightType.Directional;
            device.Lights[0].Diffuse    = Color.White;
            device.Lights[0].Direction  = new Vector3(-x, -6, -z);
            device.Lights[0].Position   = new Vector3(x, 6, z);
            device.Lights[0].Enabled    = true;

            device.Transform.World = model.transform;

            device.VertexFormat = CustomVertex.PositionNormalColored.Format;
            device.SetStreamSource(0, vertexBuffer, 0);
            device.Indices = indexBuffer;

            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, model.getVertices().Length, 0, model.getIndices().Length / 3);

            device.EndScene();
            device.Present();
        }
Exemple #2
0
        public void RenderModel(Model model)
        {
            this.model   = model;
            vertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionNormalColored), model.getVertices().Length,
                                            device, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionNormalColored.Format, Pool.Default);
            vertexBuffer.SetData(model.getVertices(), 0, LockFlags.None);

            indexBuffer = new IndexBuffer(typeof(ushort), model.getIndices().Length, device, Usage.WriteOnly, Pool.Default);
            indexBuffer.SetData(model.getIndices(), 0, LockFlags.None);

            Render();
        }
        public void RenderModel(Model model)
        {
            this.model = model;
            vertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionNormalColored), model.getVertices().Length,
                                        device, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionNormalColored.Format, Pool.Default);
            vertexBuffer.SetData(model.getVertices(), 0, LockFlags.None);

            indexBuffer = new IndexBuffer(typeof(ushort), model.getIndices().Length, device, Usage.WriteOnly, Pool.Default);
            indexBuffer.SetData(model.getIndices(), 0, LockFlags.None);

            Render();
        }