Compare commits
2 Commits
d7a119a592
...
a9d9936cb7
Author | SHA1 | Date | |
---|---|---|---|
|
a9d9936cb7 | ||
|
4dd028aeae |
@ -24,7 +24,7 @@ static void process_fly_mode(State *state) {
|
||||
SceneIngame *scn = (SceneIngame *)state->scene;
|
||||
|
||||
DrawCameraFromPrincipalAxesResult dir_and_up =
|
||||
draw_camera_from_principal_axes(scn->pos, (float)M_PI_2, scn->roll, scn->pitch, scn->yaw);
|
||||
draw_camera_from_principal_axes(scn->pos, (float)M_PI_2 * 0.8f, scn->roll, scn->pitch, scn->yaw);
|
||||
|
||||
const Vec3 right = m_vec_norm(m_vec_cross(dir_and_up.direction, dir_and_up.up));
|
||||
const float speed = 0.04f; /* TODO: put this in a better place */
|
||||
@ -52,7 +52,7 @@ static void process_ground_mode(State *state) {
|
||||
SceneIngame *scn = (SceneIngame *)state->scene;
|
||||
|
||||
DrawCameraFromPrincipalAxesResult dir_and_up =
|
||||
draw_camera_from_principal_axes(scn->pos, (float)M_PI_2, scn->roll, scn->pitch, scn->yaw);
|
||||
draw_camera_from_principal_axes(scn->pos, (float)M_PI_2 * 0.8f, scn->roll, scn->pitch, scn->yaw);
|
||||
|
||||
const Vec3 right = m_vec_norm(m_vec_cross(dir_and_up.direction, dir_and_up.up));
|
||||
const float speed = 0.18f; /* TODO: put this in a better place */
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "twn_engine_context_c.h"
|
||||
#include "twn_textures_c.h"
|
||||
#include "twn_types.h"
|
||||
#include "twn_util_c.h"
|
||||
#include "twn_vec.h"
|
||||
|
||||
#include <stb_ds.h>
|
||||
@ -85,12 +86,16 @@ void finally_draw_billboard_batch(struct MeshBatch const *batch,
|
||||
const Vec2 uv2 = { xr, yr + hr };
|
||||
const Vec2 uv3 = { xr, yr };
|
||||
|
||||
for (size_t batch_n = 0; batch_n <= (primitives_len - 1) / QUAD_ELEMENT_BUFFER_LENGTH; batch_n++) {
|
||||
|
||||
/* emit vertex data */
|
||||
VertexBuffer const buffer = get_scratch_vertex_array();
|
||||
VertexBufferBuilder builder = build_vertex_buffer(buffer, sizeof (ElementIndexedBillboard) * primitives_len);
|
||||
VertexBufferBuilder builder = build_vertex_buffer(
|
||||
buffer,
|
||||
sizeof (ElementIndexedBillboard) * MIN(primitives_len - batch_n * QUAD_ELEMENT_BUFFER_LENGTH, QUAD_ELEMENT_BUFFER_LENGTH));
|
||||
|
||||
for (size_t i = 0; i < primitives_len; ++i) {
|
||||
struct SpaceBillboard const billboard = ((SpaceBillboard *)(void *)batch->primitives)[i];
|
||||
struct SpaceBillboard const billboard = ((SpaceBillboard *)(void *)batch->primitives)[batch_n * QUAD_ELEMENT_BUFFER_LENGTH + i];
|
||||
|
||||
/* a = (right + up) * size, b = (right - up) * size*/
|
||||
Vec3 a, b;
|
||||
@ -169,4 +174,5 @@ void finally_draw_billboard_batch(struct MeshBatch const *batch,
|
||||
};
|
||||
|
||||
arrpush(deferred_commands, final_command);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user