-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/graphics'
- Loading branch information
Showing
26 changed files
with
251 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
#include <TML/Export.h> | ||
|
||
#include <cstdint> | ||
#include <vector> | ||
|
||
namespace tml | ||
{ | ||
class BufferLayout | ||
{ | ||
public: | ||
enum DataType | ||
{ | ||
VERTEX_BYTE = 0x1400, | ||
VERTEX_UNSIGNED_BYTE = 0x1401, | ||
VERTEX_SHORT = 0x1402, | ||
VERTEX_UNSIGNED_SHORT = 0x1403, | ||
VERTEX_INT = 0x1404, | ||
VERTEX_UNSIGNED_INT = 0x1405, | ||
VERTEX_FLOAT = 0x1406, | ||
}; | ||
struct Attribute | ||
{ | ||
uint32_t elements, size; | ||
DataType dataType; | ||
}; | ||
public: | ||
BufferLayout() : m_stride(0) {} | ||
|
||
void Push(uint32_t elements, uint32_t size, DataType type) noexcept | ||
{ | ||
m_layout.push_back(Attribute{elements, size, type}); | ||
m_stride += elements * size; | ||
} | ||
|
||
void Clear() | ||
{ | ||
m_layout.clear(); | ||
m_stride = 0; | ||
} | ||
|
||
std::vector<Attribute> const & GetData() const noexcept { return m_layout; } | ||
uint32_t GetStride() const noexcept { return m_stride; } | ||
|
||
private: | ||
std::vector<Attribute> m_layout; | ||
uint32_t m_stride; | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
#include <TML/Export.h> | ||
|
||
#include <cstdint> | ||
|
||
namespace tml | ||
{ | ||
class TML_API IndexBuffer | ||
{ | ||
public: | ||
IndexBuffer() noexcept; | ||
IndexBuffer(const uint32_t *data, uint32_t elements) noexcept; | ||
~IndexBuffer() noexcept; | ||
void Bind() noexcept; | ||
void Unbind() const noexcept; | ||
void BufferData(const uint32_t *data, uint32_t elements) noexcept; | ||
void PushData(const uint32_t *data, uint32_t elements) noexcept; | ||
uint32_t Elements() const noexcept { return m_elements; } | ||
|
||
public: | ||
friend class VertexArray; | ||
|
||
private: | ||
uint32_t m_id; | ||
|
||
protected: | ||
mutable uint32_t m_elements; | ||
uint32_t m_capacity; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
#include <TML/Export.h> | ||
|
||
#include <cstdint> | ||
|
||
namespace tml | ||
{ | ||
class TML_API StorageBuffer /// Shader Storage Buffer | ||
{ | ||
public: | ||
StorageBuffer() noexcept; | ||
void Bind() const noexcept; | ||
void Unbind() const noexcept; | ||
void BufferData(const void* data, uint32_t bytes) const noexcept; | ||
void UpdateData(const void* data, uint32_t bytes) const noexcept; | ||
void RetrieveData(void* data, uint32_t bytes) const noexcept; | ||
protected: | ||
void BindBufferBase(uint32_t index) const noexcept; | ||
friend class ComputeShader; | ||
private: | ||
uint32_t m_id; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.