| 49 | |
| 50 | public: |
| 51 | bool Init() |
| 52 | { |
| 53 | if (Platform::AtomicRead(&Ready)) |
| 54 | return false; |
| 55 | ScopeLock lock(RenderContext::GPULocker); |
| 56 | if (Platform::AtomicRead(&Ready)) |
| 57 | return false; |
| 58 | VB = GPUDevice::Instance->CreateBuffer(TEXT("SpriteParticleRenderer.VB")); |
| 59 | IB = GPUDevice::Instance->CreateBuffer(TEXT("SpriteParticleRenderer.IB")); |
| 60 | SpriteParticleVertex vertexBuffer[] = |
| 61 | { |
| 62 | { -0.5f, -0.5f, 0.0f, 0.0f }, |
| 63 | { +0.5f, -0.5f, 1.0f, 0.0f }, |
| 64 | { +0.5f, +0.5f, 1.0f, 1.0f }, |
| 65 | { -0.5f, +0.5f, 0.0f, 1.0f }, |
| 66 | }; |
| 67 | uint16 indexBuffer[] = { 0, 1, 2, 0, 2, 3, }; |
| 68 | auto layout = GPUVertexLayout::Get({ |
| 69 | { VertexElement::Types::Position, 0, 0, 0, PixelFormat::R32G32_Float }, |
| 70 | { VertexElement::Types::TexCoord, 0, 0, 0, PixelFormat::R32G32_Float }, |
| 71 | }); |
| 72 | bool result = VB->Init(GPUBufferDescription::Vertex(layout, sizeof(SpriteParticleVertex), VertexCount, vertexBuffer)) || |
| 73 | IB->Init(GPUBufferDescription::Index(sizeof(uint16), IndexCount, indexBuffer)); |
| 74 | Platform::AtomicStore(&Ready, 1); |
| 75 | return result; |
| 76 | } |
| 77 | |
| 78 | void Dispose() |
| 79 | { |
nothing calls this directly
no test coverage detected