internal override void SetTextureResource(PixelShaderStage pixelShader) { if (Active != -1) { pixelShader.SetShaderResource(0, resourceView[Active]); } }
public void Update(SharpDevice device, Matrix View, Matrix Projection) { TransUpdate( ); SendGPUData(device, View, Projection); MMDModelMorph.UpdateMorph(OrigVertice, Vertice); UpdateMesh( ); Mesh.Begin( ); for (int i = 0; i < Mesh.SubSets.Count; i++) { SharpSubSet sharpSubSet = Mesh.SubSets[i]; PixelShaderStage pixelShader = device.DeviceContext.PixelShader; MaterialGPUData materialData = Materials[i].MaterialData; device.DeviceContext.PixelShader.SetShaderResource(0, sharpSubSet.DiffuseMap); device.DeviceContext.PixelShader.SetShaderResource(1, sharpSubSet.SphereMap); pixelShader.SetConstantBuffer(1, MaterialDataBuffer); device.UpdateData(MaterialDataBuffer, materialData); //set texture Mesh.Draw(i); } // https://gamedev.stackexchange.com/questions/49779/different-shaders-for-different-objects-directx-11 }
internal override void SetTextureResource(PixelShaderStage pixelShader) { if (textureReady) { pixelShader.SetShaderResource(0, resourceView); } }
internal void SetTextureResource(PixelShaderStage pixelShader, string id) { if (textures.ContainsKey(id)) { if (textures.TryGetValue(id, out Tuple <ShaderResourceView, Texture2D> texture)) { pixelShader.SetShaderResource(0, texture.Item1); } } }
internal DeviceContext(Device device) : base(device) { _device = device; _inputAssembler = new InputAssemblerStage(device); _vertexShader = new VertexShaderStage(device); _geometryShader = new GeometryShaderStage(device); _rasterizer = new RasterizerStage(device); _pixelShader = new PixelShaderStage(device); _outputMerger = new OutputMergerStage(device); }
internal override void SetTextureResource(PixelShaderStage pixelShader) { if (textureReady) { if (Colored) { pixelShader.SetShaderResource(0, resourceView2); } else { pixelShader.SetShaderResource(0, resourceView1); } } }
protected void PrepareShader(SharpDevice device, string shaderPath) { //init shader Shader = new SharpShader(device, shaderPath, new SharpShaderDescription( ) { VertexShaderFunction = "VS", PixelShaderFunction = "PS" }, new InputElement[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0), new InputElement("NORMAL", 0, Format.R32G32B32_Float, 12, 0), new InputElement("TEXCOORD", 0, Format.R32G32_Float, 24, 0) }); VertexShader = device.DeviceContext.VertexShader; PixelShader = device.DeviceContext.PixelShader; GPUDataBuffer = Shader.CreateBuffer <GPUData>( ); }
internal override void SetTextureResource(PixelShaderStage pixelShader) { loader.SetTextureResource(pixelShader, TextureID); }
internal abstract void SetTextureResource(PixelShaderStage pixelShader);