public OcclusionSurrogateDebugRenderer(Device device, ShaderCache shaderCache, int occlusionInfoOffset) { surrogateFacesView = BufferUtilities.ToStructuredBufferView(device, OcclusionSurrogateCommon.Mesh.Faces.ToArray()); meshBuffers = new MeshBuffers(device, DrawMesh); var vertexShaderAndBytecode = shaderCache.GetVertexShader <OcclusionSurrogateDebugRenderer>("figure/occlusion/debug/DebugVertex"); vertexShader = vertexShaderAndBytecode; inputLayout = new InputLayout(device, vertexShaderAndBytecode.Bytecode, MeshBuffers.InputElements); using (var texture = MonochromaticTextures.Make(device, Color.LightGray)) { var textureView = new ShaderResourceView(device, texture); material = new BasicSpecularMaterial(device, shaderCache, textureView); } }
public void Init(Type type, BuilderData.Meta meta) { submitted = false; this.type = type; this.meta = meta; if (meshes == null) { meshes = new List <MeshWithType>(); } if (!temporaryMeshBuffers.IsCreated) { temporaryMeshBuffers = new NativeArray <MeshBuffers>(1, Allocator.Persistent, NativeArrayOptions.UninitializedMemory); temporaryMeshBuffers[0] = new MeshBuffers(Allocator.Persistent); } }
private void Update(EvaluationContext context) { var mesh = MeshBuffers.GetValue(context); if (mesh == null) { Vertices.Value = null; Indices.Value = null; return; } Vertices.Value = mesh.VertexBuffer; Indices.Value = mesh.IndicesBuffer; Vertices.DirtyFlag.Clear(); Indices.DirtyFlag.Clear(); }
void SetupBuffers() { if (!m_baseMeshBuffers.valid) { m_baseMeshBuffers.Assign(baseMesh); } if (m_blendSourceBuffers.Count != blendSources.Count) { m_blendSourceBuffers.Clear(); for (int si = 0; si < blendSources.Count; ++si) { var tmp = new MeshBuffers(); tmp.Assign(blendSources[si].mesh); m_blendSourceBuffers.Add(tmp); } } }
public MeshRenderer(Device device, ShaderCache shaderCache, Matrix transform, TriMesh mesh) { this.meshBuffers = new MeshBuffers(device, mesh); this.modelToWorldTransform = new CoordinateNormalMatrixPairConstantBufferManager(device); var vertexShaderAndBytecode = shaderCache.GetVertexShader <MeshRenderer>("game/MeshVertex"); this.vertexShader = vertexShaderAndBytecode; this.inputLayout = new InputLayout(device, vertexShaderAndBytecode.Bytecode, MeshBuffers.InputElements); using (var texture = MonochromaticTextures.Make(device, Color.LightGray)) { var textureView = new ShaderResourceView(device, texture); this.material = new BasicSpecularMaterial(device, shaderCache, textureView); } this.transform = transform; }
public Backdrop(Device device, ShaderCache shaderCache) { float size = 5f; Matrix transform = Matrix.Translation(0, size / 2, 0); QuadMesh mesh = GeometricPrimitiveFactory.MakeCube(size).Flip(); this.meshBuffers = new MeshBuffers(device, mesh.AsTriMesh()); this.modelToWorldTransform = new CoordinateNormalMatrixPairConstantBufferManager(device); var vertexShaderAndBytecode = shaderCache.GetVertexShader <Backdrop>("backdrop/Backdrop"); this.vertexShader = vertexShaderAndBytecode; this.inputLayout = new InputLayout(device, vertexShaderAndBytecode.Bytecode, MeshBuffers.InputElements); this.pixelShader = shaderCache.GetPixelShader <Backdrop>("backdrop/Backdrop"); this.transform = transform; }