Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/shaders/common_pointcloud_lib.glsl
| /* NOTE: To be used with UNIFORM_RESOURCE_ID and INSTANCED_ATTR as define. */ | /* NOTE: To be used with UNIFORM_RESOURCE_ID and INSTANCED_ATTR as define. */ | ||||
| #pragma BLENDER_REQUIRE(common_view_lib.glsl) | #pragma BLENDER_REQUIRE(common_view_lib.glsl) | ||||
| in vec4 pos; /* Position and radius. */ | in vec4 pos; /* Position and radius. */ | ||||
| /* ---- Instanced attribs ---- */ | /* ---- Instanced attribs ---- */ | ||||
| in vec3 pos_inst; | in vec3 pos_inst; | ||||
| in vec3 nor; | in vec3 nor; | ||||
| mat3 pointcloud_get_facing_matrix(vec3 p) | mat3 pointcloud_get_facing_matrix(vec3 p) | ||||
| { | { | ||||
| mat3 facing_mat; | mat3 facing_mat; | ||||
| facing_mat[2] = normalize(ViewMatrixInverse[3].xyz - p); | facing_mat[2] = cameraVec(p); | ||||
| facing_mat[1] = normalize(cross(ViewMatrixInverse[0].xyz, facing_mat[2])); | facing_mat[1] = normalize(cross(ViewMatrixInverse[0].xyz, facing_mat[2])); | ||||
| facing_mat[0] = cross(facing_mat[1], facing_mat[2]); | facing_mat[0] = cross(facing_mat[1], facing_mat[2]); | ||||
| return facing_mat; | return facing_mat; | ||||
| } | } | ||||
| /* Return world position and normal. */ | /* Return world position and normal. */ | ||||
| void pointcloud_get_pos_and_nor(out vec3 outpos, out vec3 outnor) | void pointcloud_get_pos_and_nor(out vec3 outpos, out vec3 outnor) | ||||
| { | { | ||||
| Show All 16 Lines | |||||