public SourceChannel(Component_RenderingPipeline.RenderSceneData.MeshDataRenderOperation sourceOper, VertexElementSemantic semantic, VertexElementType type) : this() { if (sourceOper.VertexStructure.GetElementBySemantic(semantic, out sourceElement) && sourceElement.Type == type) { sourceBuffer = sourceOper.VertexBuffers[sourceElement.Source]; SourceData = sourceBuffer.ExtractChannel <TBuffer>(sourceElement.Offset); Exists = true; } }
public void SetInstanceDataBuffer(GpuVertexBuffer buffer, int startVertex /*= 0*/, int count /*= -1*/) { if (buffer.Flags.HasFlag(GpuBufferFlags.Dynamic) || buffer.Flags.HasFlag(GpuBufferFlags.ComputeWrite)) { Bgfx.SetInstanceDataBuffer((DynamicVertexBuffer)buffer.GetNativeObject(), startVertex, count); } else { Bgfx.SetInstanceDataBuffer((VertexBuffer)buffer.GetNativeObject(), startVertex, count); } }
public void SetVertexBuffer(int stream, GpuVertexBuffer buffer, int startVertex = 0, int count = -1) { if (buffer.Flags.HasFlag(GpuBufferFlags.Dynamic) || buffer.Flags.HasFlag(GpuBufferFlags.ComputeWrite)) { Bgfx.SetVertexBuffer(stream, (DynamicVertexBuffer)buffer.GetNativeObject(), startVertex, count); } else { Bgfx.SetVertexBuffer(stream, (VertexBuffer)buffer.GetNativeObject(), startVertex, count); } }
public ChannelFloat4( Component_RenderingPipeline.RenderSceneData.MeshDataRenderOperation sourceOper, Component_RenderingPipeline.RenderSceneData.MeshDataRenderOperation destOper, VertexElementSemantic semantic ) : this() { if (sourceOper.VertexStructure.GetElementBySemantic(semantic, out VertexElement sourceElement) && sourceElement.Type == VertexElementType.Float4) { var sourceBuffer = sourceOper.VertexBuffers[sourceElement.Source]; SourceData = sourceBuffer.ExtractChannel <Vector4F>(sourceElement.Offset); if (destOper.VertexStructure.GetElementBySemantic(semantic, out destElement) && destElement.Type == VertexElementType.Float4) { destBuffer = destOper.VertexBuffers[destElement.Source]; DestData = new Vector4F[destBuffer.VertexCount]; Exists = true; } } }