UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

2 lines (1 loc) 1.18 kB
export default "// For PI declaration:\n#include <common>\n\nattribute vec2 particlesSimUv;\nuniform sampler2D texture_position;\n// uniform sampler2D textureVelocity;\n\n// uniform float cameraConstant;\n// uniform float density;\n\n// varying vec4 vColor;\n\n// float radiusFromMass( float mass ) {\n// // Calculate radius of a sphere from mass and density\n// return pow( ( 3.0 / ( 4.0 * PI ) ) * mass / density, 1.0 / 3.0 );\n// }\n\n\nvoid main() {\n\n\n vec3 P = texture2D( texture_position, particlesSimUv ).xyz;\n\n // vec4 velTemp = texture2D( textureVelocity, uv );\n // vec3 vel = velTemp.xyz;\n // float mass = velTemp.w;\n\n // vColor = vec4( 1.0, mass / 250.0, 0.0, 1.0 );\n\n vec4 mvPosition = modelViewMatrix * vec4( P, 1.0 );\n\n // Calculate radius of a sphere from mass and density\n //float radius = pow( ( 3.0 / ( 4.0 * PI ) ) * mass / density, 1.0 / 3.0 );\n // float radius = radiusFromMass( mass );\n\n // Apparent size in pixels\n // if ( mass == 0.0 ) {\n // gl_PointSize = 0.0;\n // }\n // else {\n // gl_PointSize = radius * cameraConstant / ( - mvPosition.z );\n // }\n gl_PointSize = 10.0;\n\n gl_Position = projectionMatrix * mvPosition;\n\n}";