PointSprite Particle Shader Bug

With the newest sources from the Github, I get this error when using particles with point sprite set to true:

WARNING: Bad compile of:
1    #version 110
2    #define VERTEX_SHADER 1
3    #define POINT_SPRITE 1
4    #define USE_TEXTURE 1
5    uniform mat4 g_WorldViewProjectionMatrix;
6    
7    attribute vec3 inPosition;
8    attribute vec4 inColor;
9    attribute vec4 inTexCoord;
10    
11    varying vec4 color;
12    
13    #ifdef USE_TEXTURE
14    varying vec4 texCoord;
15    #endif
16    
17    #ifdef POINT_SPRITE
18    uniform mat4 g_WorldViewMatrix;
19    uniform mat4 g_WorldMatrix;
20    uniform vec3 g_CameraPosition;
21    uniform float m_Quadratic;
22    const float SIZE_MULTIPLIER = 4.0;
23    attribute float inSize;
24    #endif
25    
26    void main(){
27        vec4 pos = vec4(inPosition, 1.0);
28    
29        gl_Position = g_WorldViewProjectionMatrix * pos;
30        color = inColor;
31    
32        #ifdef USE_TEXTURE
33            texCoord = inTexCoord;
34        #endif
35    
36        #ifdef POINT_SPRITE
37            vec4 worldPos = g_WorldMatrix * pos;
38            float d = distance(g_CameraPosition.xyz, worldPos.xyz);
39            float size = (inSize * SIZE_MULTIPLIER * m_Quadratic) / d);
40            gl_PointSize = max(1.0, size);
41    
42            //vec4 worldViewPos = g_WorldViewMatrix * pos;
43            //gl_PointSize = (inSize * SIZE_MULTIPLIER * m_Quadratic)*100.0 / worldViewPos.z;
44    
45            color.a *= min(size, 1.0);
46        #endif
47    }

feb. 24, 2016 6:39:13 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Misc/Particle.vert, defines, type=Vertex, language=GLSL100]
ERROR: 0:39: ')' : syntax error syntax error

There is one bracket too much in line 35 of source code. :wink:

*line 39

Fixed!

1 Like