21 const float cx = c.
GetX(), cy = c.GetY(), cz = c.GetZ();
22 const float ex = std::fabs(e.GetX());
23 const float ey = std::fabs(e.GetY());
24 const float ez = std::fabs(e.GetZ());
27 cx * m(0, 0) + cy * m(1, 0) + cz * m(2, 0) + m(3, 0),
28 cx * m(0, 1) + cy * m(1, 1) + cz * m(2, 1) + m(3, 1),
29 cx * m(0, 2) + cy * m(1, 2) + cz * m(2, 2) + m(3, 2));
31 ex * std::fabs(m(0, 0)) + ey * std::fabs(m(1, 0)) +
32 ez * std::fabs(m(2, 0)),
33 ex * std::fabs(m(0, 1)) + ey * std::fabs(m(1, 1)) +
34 ez * std::fabs(m(2, 1)),
35 ex * std::fabs(m(0, 2)) + ey * std::fabs(m(1, 2)) +
36 ez * std::fabs(m(2, 2)));
37 return Math::AABB(center - extents, center + extents);
57 if (!VertexBuffer.IsValid())
60 if (!IndexBuffer.IsValid())
75 if (m_hasLocalBounds || m_hasCullBounds) {
77 bool cullReady = m_hasCullBounds;
79 if (m_hasLocalBounds && tc) {
90 if (tc) tc->SubmitRenderState();
93 mc->SubmitRenderState();
99 this->VertexBuffer = buffer;
103 this->IndexBuffer = buffer;
111 ConstantBuffers.add(buffer);
116 ConstantBuffers.add(buffer);
120 m_cullBounds = bounds;
121 m_hasCullBounds =
true;
122 m_hasLocalBounds =
false;
126 m_localBounds = bounds;
127 m_hasLocalBounds =
true;
Component(GameObject *object)
static bool IsVisibleFrustumOnly(const Math::AABB &box)
Frustum-only visibility test, skipping the occlusion buffer entirely.
T * GetComponent()
Finds the first attached component of type T, or nullptr.
size_t GetByteSize() const
virtual void Update(float deltaTime) override
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.