18 float x = p.GetX(), y = p.GetY(), z = p.GetZ();
20 x * m(0, 0) + y * m(1, 0) + z * m(2, 0) + m(3, 0),
21 x * m(0, 1) + y * m(1, 1) + z * m(2, 1) + m(3, 1),
22 x * m(0, 2) + y * m(1, 2) + z * m(2, 2) + m(3, 2));
43 if (!VertexBuffer.IsValid())
46 if (!IndexBuffer.IsValid())
58 if (m_hasLocalBounds || m_hasCullBounds) {
60 bool cullReady = m_hasCullBounds;
62 if (m_hasLocalBounds &&
owner) {
65 Math::AABB acc = TransformedPoint(m_localBounds.Corner(0), m);
66 for (
int i = 1; i < 8; ++i)
67 acc.
Merge(TransformedPoint(m_localBounds.Corner(i), m));
82 this->VertexBuffer = buffer;
86 this->IndexBuffer = buffer;
94 ConstantBuffers.add(buffer);
99 ConstantBuffers.add(buffer);
103 m_cullBounds = bounds;
104 m_hasCullBounds =
true;
105 m_hasLocalBounds =
false;
109 m_localBounds = bounds;
110 m_hasLocalBounds =
true;
Component(GameObject *object)
static bool IsVisibleFrustumOnly(const Math::AABB &box)
Frustum-only visibility test, skipping the occlusion buffer entirely.
size_t GetByteSize() const
virtual void Update(float deltaTime) override
Culls against cull bounds if set, then submits an indexed draw call.
void SetIndexBuffer(RefPtr< RenderEngine::BufferBase > &buffer)
void AddConstantBuffer(RenderEngine::TransformBuffer &bufferData)
Creates a new constant buffer from bufferData and appends it to the draw's buffer list.
void SetVertexBuffer(RefPtr< RenderEngine::BufferBase > &buffer)
virtual bool Initialize() override
Validates that vertex and index buffers were created successfully.
void SetCullBoundsLocal(const Math::AABB &bounds)
void SetCullBoundsWorld(const Math::AABB &bounds)
MeshComponent(GameObject *object)
static RenderCommandQueue * GetInstance()
Lazily creates and returns the process-wide singleton instance.
void SubmitDrawIndexed(RefPtr< BufferBase > vertexBuffer, RefPtr< BufferBase > indexBuffer, List< RefPtr< BufferBase > > constantBuffers, uint32_t indexCount, uint32_t startIndexLocation=0, int32_t baseVertexLocation=0, bool castsShadow=true)
Queues an indexed draw with its vertex/index buffers and constant buffers.
static BufferBase * CreateBuffer(BufferType Type, uint32_t Size, void *Data)
Creates a buffer via the currently registered backend factory.
size_t GetSizeInBytes() const
Matrix< float, 4, 4 > Matrix4
Root namespace for everything the engine exposes.
void Merge(const AABB &o)
Grows this box to also cover o.