mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
add particles (WIP)
This commit is contained in:
parent
a0f885e26a
commit
217176f74f
8 changed files with 280 additions and 4 deletions
|
|
@ -29,13 +29,18 @@ public:
|
|||
|
||||
~MainBatch();
|
||||
|
||||
void begin();
|
||||
|
||||
void prepare(int vertices);
|
||||
void setTexture(const Texture* texture);
|
||||
void setTexture(const Texture* texture, const UVRegion& region);
|
||||
void flush();
|
||||
|
||||
inline void vertex(
|
||||
glm::vec3 pos, glm::vec2 uv, glm::vec4 light, glm::vec3 tint
|
||||
const glm::vec3& pos,
|
||||
const glm::vec2& uv,
|
||||
const glm::vec4& light,
|
||||
const glm::vec3& tint
|
||||
) {
|
||||
float* buffer = this->buffer.get();
|
||||
buffer[index++] = pos.x;
|
||||
|
|
@ -59,4 +64,53 @@ public:
|
|||
|
||||
buffer[index++] = compressed.floating;
|
||||
}
|
||||
|
||||
inline void quad(
|
||||
const glm::vec3& pos,
|
||||
const glm::vec3& right,
|
||||
const glm::vec3& up,
|
||||
const glm::vec2& size,
|
||||
const glm::vec4& light,
|
||||
const glm::vec3& tint,
|
||||
const UVRegion& subregion
|
||||
) {
|
||||
prepare(6);
|
||||
vertex(
|
||||
pos - right * size.x * 0.5f - up * size.y * 0.5f,
|
||||
{subregion.u1, subregion.v1},
|
||||
light,
|
||||
tint
|
||||
);
|
||||
vertex(
|
||||
pos + right * size.x * 0.5f - up * size.y * 0.5f,
|
||||
{subregion.u2, subregion.v1},
|
||||
light,
|
||||
tint
|
||||
);
|
||||
vertex(
|
||||
pos + right * size.x * 0.5f + up * size.y * 0.5f,
|
||||
{subregion.u2, subregion.v2},
|
||||
light,
|
||||
tint
|
||||
);
|
||||
|
||||
vertex(
|
||||
pos - right * size.x * 0.5f - up * size.y * 0.5f,
|
||||
{subregion.u1, subregion.v1},
|
||||
light,
|
||||
tint
|
||||
);
|
||||
vertex(
|
||||
pos + right * size.x * 0.5f + up * size.y * 0.5f,
|
||||
{subregion.u2, subregion.v2},
|
||||
light,
|
||||
tint
|
||||
);
|
||||
vertex(
|
||||
pos - right * size.x * 0.5f + up * size.y * 0.5f,
|
||||
{subregion.u1, subregion.v2},
|
||||
light,
|
||||
tint
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue