/// <summary>
        /// Normal Draw Function.
        /// </summary>
        /// <param name="gt">The gt.</param>
        /// <param name="obj">The obj.</param>
        /// <param name="cam">The cam.</param>
        /// <param name="lights">The lights.</param>
        /// <param name="render">The render.</param>
        public void Drawn(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
        {
            PhysxClothObject PhysxClothObject = obj.PhysicObject as PhysxClothObject;
            ClothModel       ClothModel       = obj.Modelo as ClothModel;

            StillDesign.PhysX.MathPrimitives.Vector3[] pos  = PhysxClothObject.Cloth.GetMeshData().PositionsStream.GetData <StillDesign.PhysX.MathPrimitives.Vector3>();
            StillDesign.PhysX.MathPrimitives.Vector3[] norm = PhysxClothObject.Cloth.GetMeshData().NormalsStream.GetData <StillDesign.PhysX.MathPrimitives.Vector3>();

            for (int i = 0; i < ClothModel.BatchInformation.NumVertices; i++)
            {
                ClothModel.vertexPositionNormalTexture[i].Position = pos[i].AsXNA();
                ClothModel.vertexPositionNormalTexture[i].Normal   = norm[i].AsXNA();
            }

            ClothModel.BatchInformation.VertexBuffer.SetData <VertexPositionNormalTexture>(ClothModel.vertexPositionNormalTexture);

            if (rasterizerState != null && rasterizerState != render.PeekRasterizerState())
            {
                rasterStateFlag = true;
                render.PushRasterizerState(rasterizerState);
            }

            shader.iDraw(gt, obj, render, cam, lights);

            if (rasterStateFlag)
            {
                render.PopRasterizerState();
                rasterStateFlag = false;
            }
        }
        /// <summary>
        /// Normal Draw Function.
        /// </summary>
        /// <param name="gt">The gt.</param>
        /// <param name="obj">The obj.</param>
        /// <param name="cam">The cam.</param>
        /// <param name="lights">The lights.</param>
        /// <param name="render">The render.</param>
        public void Drawn(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
        {
            if (rasterizerState != null && rasterizerState != render.PeekRasterizerState())
            {
                rasterStateFlag = true;
                render.PushRasterizerState(rasterizerState);
            }

            shader.iDraw(gt, obj, render, cam, lights);

            if (rasterStateFlag)
            {
                render.PopRasterizerState();
                rasterStateFlag = false;
            }
        }
示例#3
0
        public void Drawn(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
        {
            if (SamplePositions != null)
            {
                for (int i = 0; i < SamplePositions.Count(); i++)
                {
                    render.SetSamplerState(SamplerState[i], SamplePositions[i]);
                    samplers[SamplePositions[i]] = SamplerState[i];
                }
            }

            if (BlendState != null)
            {
                render.PushBlendState(BlendState);
            }
            if (RasterizerState != null)
            {
                render.PushRasterizerState(RasterizerState);
            }
            material.Drawn(gt, obj, cam, lights, render);

            if (RasterizerState != null)
            {
                render.PopRasterizerState();
            }
            if (BlendState != null)
            {
                render.PopBlendState();
            }

            if (SamplePositions != null)
            {
                for (int i = 0; i < SamplePositions.Count(); i++)
                {
                    render.SetSamplerState(samplers[SamplePositions[i]], SamplePositions[i]);
                }
            }
        }