small billboarding changes
parent
d5a0dac5d4
commit
b7344c7298
|
@ -7,7 +7,7 @@ int main() {
|
||||||
// options
|
// options
|
||||||
bool do_twosided = 1;
|
bool do_twosided = 1;
|
||||||
bool do_wireframe = 0;
|
bool do_wireframe = 0;
|
||||||
bool do_billboard_x = 0, do_billboard_y = 0, do_billboard_z = 0;
|
bool do_billboard_x = 1, do_billboard_y = 1, do_billboard_z = 1;
|
||||||
|
|
||||||
// window (80% sized, MSAA x4 flag)
|
// window (80% sized, MSAA x4 flag)
|
||||||
window_create(80, WINDOW_MSAA4);
|
window_create(80, WINDOW_MSAA4);
|
||||||
|
|
|
@ -126,14 +126,17 @@ void main() {
|
||||||
vec3 cameraPosition = -transpose(mat3(view)) * view[3].xyz;
|
vec3 cameraPosition = -transpose(mat3(view)) * view[3].xyz;
|
||||||
vec3 lookDir = normalize(cameraPosition - v_position_ws);
|
vec3 lookDir = normalize(cameraPosition - v_position_ws);
|
||||||
|
|
||||||
vec3 up = vec3(view[0][1], view[1][1], view[2][1]);
|
vec3 up = vec3(modelView[0][1], modelView[1][1], modelView[2][1]);
|
||||||
vec3 right = normalize(cross(up, lookDir));
|
vec3 right = normalize(cross(up, lookDir));
|
||||||
up = cross(lookDir, right);
|
up = cross(lookDir, right);
|
||||||
|
|
||||||
vec3 scale;
|
vec3 scale;
|
||||||
scale.x = length(vec3(att_instanced_matrix[0]));
|
scale.x = length(vec3(l_model[0]));
|
||||||
scale.y = length(vec3(att_instanced_matrix[1]));
|
scale.y = length(vec3(l_model[1]));
|
||||||
scale.z = length(vec3(att_instanced_matrix[2]));
|
scale.z = length(vec3(l_model[2]));
|
||||||
|
// scale.x *= sign(l_model[0][0]);
|
||||||
|
// scale.y *= sign(l_model[1][1]);
|
||||||
|
// scale.z *= sign(l_model[2][2]);
|
||||||
|
|
||||||
mat4 billboardRotation = mat4(
|
mat4 billboardRotation = mat4(
|
||||||
vec4(right * scale.x, 0.0),
|
vec4(right * scale.x, 0.0),
|
||||||
|
|
|
@ -354485,7 +354485,7 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent","fragColor",
|
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent","fragColor",
|
||||||
va("SHADING_PHONG,%s", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
va("SHADING_PHONG,%s", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||||
// }
|
// }
|
||||||
// ASSERT(shaderprog > 0);
|
ASSERT(shaderprog > 0);
|
||||||
|
|
||||||
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
||||||
m.program = shaderprog;
|
m.program = shaderprog;
|
||||||
|
|
|
@ -4398,7 +4398,7 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent","fragColor",
|
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent","fragColor",
|
||||||
va("SHADING_PHONG,%s", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
va("SHADING_PHONG,%s", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||||
// }
|
// }
|
||||||
// ASSERT(shaderprog > 0);
|
ASSERT(shaderprog > 0);
|
||||||
|
|
||||||
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
||||||
m.program = shaderprog;
|
m.program = shaderprog;
|
||||||
|
|
|
@ -20562,7 +20562,7 @@ model_t model_from_mem(const void *mem, int len, int flags) {
|
||||||
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent","fragColor",
|
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent","fragColor",
|
||||||
va("SHADING_PHONG,%s", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
va("SHADING_PHONG,%s", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||||
// }
|
// }
|
||||||
// ASSERT(shaderprog > 0);
|
ASSERT(shaderprog > 0);
|
||||||
|
|
||||||
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
iqm_t *q = CALLOC(1, sizeof(iqm_t));
|
||||||
m.program = shaderprog;
|
m.program = shaderprog;
|
||||||
|
|
Loading…
Reference in New Issue