/// <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; } }