private RenderTargetObject(LightDevice device) { _device = device; device.AddComponent(this); device.ReleaseRenderTargets += ReleaseView; device.RebuildRenderTargets += RebuildView; }
internal protected AbstractConstantBuffer(LightDevice device, IntPtr buffer) { _device = device; device.AddComponent(this); _buffer = buffer; }
internal AbstractShaderResourceBuffer(LightDevice device, IntPtr pBuffer, IntPtr pView) { _device = device; device.AddComponent(this); _pBuffer = pBuffer; _pView = pView; }
//TODO get pipeline object internal VertexDataProcessor(LightDevice device, IntPtr layout) { _device = device; device.AddComponent(this); _inputLayout = layout; _bufferUpdate = new BufferUpdate(device); }
internal IndexBuffer(LightDevice device, IntPtr ptr, int bitWidth, int size) { _device = device; device.AddComponent(this); _ptr = ptr; _bitWidth = bitWidth; _size = size; }
internal Texture2D(LightDevice device, IntPtr tex, IntPtr view, int w, int h, bool holdPtr = true) { _device = device; device.AddComponent(this); _holdPointer = holdPtr; _texture = tex; _view = view; Width = w; Height = h; }
internal VertexBuffer(LightDevice device, IBufferUpdate update, IntPtr buffer, IntPtr layout, int stride, int vertexCount, bool isDynamic) { _device = device; device.AddComponent(this); _update = update; _buffer = buffer; _layout = layout; _stride = (uint)stride; _vertexCount = vertexCount; _isDynamic = isDynamic; }
internal Pipeline(LightDevice device, IntPtr v, IntPtr g, IntPtr p, IntPtr sign, InputTopology topology) { _device = device; device.AddComponent(this); _device.ResolutionChanged += DeviceBufferResized; _vertex = v; _geometry = g; _pixel = p; _signatureBlob = sign; _viewport = new Viewport { Width = _device.ScreenWidth, Height = _device.ScreenHeight, MaxDepth = 1.0f, }; _topology = topology; }
public AbstractFontCache(LightDevice device, Font font, PixelFormat format, Color foreground, Color background) { _device = device; device.AddComponent(this); Font = font; PixelFormat = format; BackgroundColor = background; ForegroundColor = foreground; _brush = new SolidBrush(foreground); var height = (int)Math.Ceiling(font.GetHeight()); int bitmapSize; if (height < 85) { bitmapSize = 256; } else { bitmapSize = Round2Power(height * 3); } BufferWidth = bitmapSize; BufferHeight = bitmapSize; _gdiBitmap = new Bitmap(BufferWidth, BufferHeight, format); _gdiBitmapGraphics = Graphics.FromImage(_gdiBitmap); _gdiBitmapGraphics.TextRenderingHint = TextRenderingHint.AntiAlias; _formatSingle = new StringFormat(); _formatSingle.SetMeasurableCharacterRanges(new[] { new CharacterRange(0, 1) }); _formatDouble = new StringFormat(); _formatDouble.SetMeasurableCharacterRanges(new[] { new CharacterRange(0, 2) }); _empty = new CachedRegion { Bitmap = null, X = 0, Y = 0, Width = 0, Height = 0, }; }
public Sprite(LightDevice device) { _device = device; device.AddComponent(this); _pipeline = device.CompilePipeline(InputTopology.Triangle, ShaderSource.FromString(PipelineCode, ShaderType.Vertex | ShaderType.Pixel)); _pipeline.SetBlender(Blender.AlphaBlender); _vertexProcessor = _pipeline.CreateVertexDataProcessor <Vertex>(); _array = new[] { new Vertex { TexCoord = new Vector4(0, 0, 0, 0), Position = new Vector4(0, 0, 0, 0) }, new Vertex { TexCoord = new Vector4(1, 0, 0, 0), Position = new Vector4(1, 0, 0, 0) }, new Vertex { TexCoord = new Vector4(0, 1, 0, 0), Position = new Vector4(0, 1, 0, 0) }, new Vertex { TexCoord = new Vector4(0, 1, 0, 0), Position = new Vector4(0, 1, 0, 0) }, new Vertex { TexCoord = new Vector4(1, 0, 0, 0), Position = new Vector4(1, 0, 0, 0) }, new Vertex { TexCoord = new Vector4(1, 1, 0, 0), Position = new Vector4(1, 1, 0, 0) }, }; _buffer = _vertexProcessor.CreateDynamicBuffer(6); _constant = _pipeline.CreateConstantBuffer <VSConstant>(); _pipeline.SetConstant(ShaderType.Vertex, 0, _constant); }