protected override void _Render(DXCamera camera) { EffectTechnique technique = _shader.DXEffect.GetTechniqueByIndex(0); for (int i = 0; i < 5; i++) { if (_vertexBuffer2[i] != null && Program.DXSceneOptions.LevelVisibility[i]) { DXContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(_vertexBuffer2[i], Marshal.SizeOf(typeof(DXMEV)), 0)); DXContext.InputAssembler.SetIndexBuffer(_indexBuffer2[i], Format.R32_UInt, 0); DXContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList; DXContext.InputAssembler.InputLayout = _inputLayout; _shader.SetParameter("worldMatrix", Matrix.Identity); _shader.SetParameter("viewMatrix", camera.ViewMatrix); _shader.SetParameter("projectionMatrix", camera.ProjMatrix); _shader.SetParameter("wvp", Matrix.Identity * camera.ViewMatrix * camera.ProjMatrix); EffectPass usePass = technique.GetPassByIndex(0); usePass.Apply(DXContext); DXContext.DrawIndexed(IndexCount2[i], 0, 0); usePass.Dispose(); usePass = technique.GetPassByIndex(1); usePass.Apply(DXContext); DXContext.DrawIndexed(IndexCount2[i], 0, 0); usePass.Dispose(); } } technique.Dispose(); }
private void InitShaders() { _shader = Program.DXShaderManager.MakeShader("TreeSkeleton"); // Create the InputElement _inputElements = new InputElement[] { new InputElement("POSITION", 0, SharpDX.DXGI.Format.R32G32B32_Float, 0, 0), new InputElement("COLOR", 0, SharpDX.DXGI.Format.R32G32B32_Float, 12, 0) }; // Create the InputLayout EffectTechnique technique = _shader.DXEffect.GetTechniqueByIndex(0); EffectPass usePass = technique.GetPassByIndex(0); _inputLayout = new InputLayout(DXDevice, usePass.Description.Signature, _inputElements); technique.Dispose(); usePass.Dispose(); }
private void InitShaders() { _shader = Program.DXShaderManager.MakeShader("SolidWireframe"); // Create the InputElement _inputElements = new InputElement[] { new InputElement("POSITION", 0, SharpDX.DXGI.Format.R32G32B32A32_Float, 0, 0), new InputElement("TEXCOORD", 0, SharpDX.DXGI.Format.R32G32_Float, 16, 0), new InputElement("NORMAL", 0, SharpDX.DXGI.Format.R32G32B32_Float, 24, 0), new InputElement("TANGENT", 0, SharpDX.DXGI.Format.R32G32B32_Float, 36, 0) }; // Create the InputLayout EffectTechnique technique = _shader.DXEffect.GetTechniqueByIndex(0); EffectPass usePass = technique.GetPassByIndex(0); _inputLayout = new InputLayout(DXDevice, usePass.Description.Signature, _inputElements); technique.Dispose(); usePass.Dispose(); }