internal void RShader_Render(string techniqueName)
{
Matrix[] bones = _player.GetSkinTransforms();
GraphicsDevice graphicsDevice = REngine.Instance._graphics.GraphicsDevice;
REngine.Instance._graphics.GraphicsDevice.RasterizerState.CullMode = CullMode.CullCounterClockwiseFace;
REngine.Instance._graphics.GraphicsDevice.DepthStencilState.DepthBufferEnable = true;
REngine.Instance._graphics.GraphicsDevice.BlendState = BlendState.Opaque;
_material.Prepare(this);
Effect e = _material.shader.effect;
e.CurrentTechnique = e.Techniques[techniqueName];
RCamera camera = REngine.Instance._camera;
foreach (ModelMesh mesh in _model.Meshes)
{
foreach (Effect effect in mesh.Effects)
{
//effect.Begin();
effect.Parameters["Bones"].SetValue(bones);
effect.Parameters["View"].SetValue(camera.viewMatrix);
effect.Parameters["Projection"].SetValue(camera.projMatrix);
/*foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Begin();
foreach (ModelMeshPart part in mesh.MeshParts)
{
graphicsDevice.VertexDeclaration = part.VertexDeclaration;
graphicsDevice.Vertices[0].SetSource(mesh.VertexBuffer, part.StreamOffset, part.VertexStride);
graphicsDevice.Indices = mesh.IndexBuffer;
graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, part.BaseVertex, 0, part.NumVertices, part.StartIndex, part.PrimitiveCount);
}
pass.End();
}
effect.End();
*/
}
mesh.Draw();
}
}