コード例 #1
0
        //draw a NON-TEXTURED primitive i.e. vertices (and possibly indices) defined by the user
        private void DrawObject(GameTime gameTime, PrimitiveObject primitiveObject, Camera3D activeCamera)
        {
            if (activeCamera.BoundingFrustum.Intersects(primitiveObject.BoundingSphere))
            {
                primitiveObject.EffectParameters.SetParameters(activeCamera);
                primitiveObject.EffectParameters.SetWorld(primitiveObject.GetWorldMatrix());
                primitiveObject.VertexData.Draw(gameTime, primitiveObject.EffectParameters.Effect);

#if DEBUG
                debugDrawCount++;
#endif
            }
        }
コード例 #2
0
        //draw a NON-TEXTURED primitive i.e. vertices (and possibly indices) defined by the user
        private void DrawObject(GameTime gameTime, PrimitiveObject primitiveObject)
        {
            BasicEffect effect = primitiveObject.Effect as BasicEffect;

            //W, V, P, Apply, Draw
            effect.World      = primitiveObject.GetWorldMatrix();
            effect.View       = (this.Game as Main).CameraManager.ActiveCamera.View;
            effect.Projection = (this.Game as Main).CameraManager.ActiveCamera.ProjectionParameters.Projection;

            effect.DiffuseColor = primitiveObject.Color.ToVector3();
            effect.Alpha        = primitiveObject.Alpha;

            effect.CurrentTechnique.Passes[0].Apply();
            primitiveObject.VertexData.Draw(gameTime, effect);
        }