Android morph fix (#1221)

* Fixed MorphAnim.glsllib to compile on android and avoid enabling GL_VERTEX_PROGRAM_POINT_SIZE in android as it's not supported
This commit is contained in:
joliver82 2019-11-24 06:50:09 +01:00 committed by Ali-RS
parent 48f28974f9
commit 30df2f1b87
2 changed files with 5 additions and 7 deletions

View File

@ -612,7 +612,7 @@ public final class GLRenderer implements Renderer {
int vaoId = intBuf16.get(0); int vaoId = intBuf16.get(0);
gl3.glBindVertexArray(vaoId); gl3.glBindVertexArray(vaoId);
} }
if (gl2 != null) { if (gl2 != null && !(gl instanceof GLES_30)) {
gl2.glEnable(GL2.GL_VERTEX_PROGRAM_POINT_SIZE); gl2.glEnable(GL2.GL_VERTEX_PROGRAM_POINT_SIZE);
if (!caps.contains(Caps.CoreProfile)) { if (!caps.contains(Caps.CoreProfile)) {
gl2.glEnable(GL2.GL_POINT_SPRITE); gl2.glEnable(GL2.GL_POINT_SPRITE);

View File

@ -3,8 +3,6 @@ A glsllib that perform morph animation.
Note that it only handles morphing position, normals and tangents. Note that it only handles morphing position, normals and tangents.
*/ */
#ifdef NUM_MORPH_TARGETS #ifdef NUM_MORPH_TARGETS
vec3 dummy_norm = vec3(0.0);
vec3 dummy_tan = vec3(0.0);
#define NUM_BUFFERS NUM_MORPH_TARGETS * NUM_TARGETS_BUFFERS #define NUM_BUFFERS NUM_MORPH_TARGETS * NUM_TARGETS_BUFFERS
#if (NUM_BUFFERS > 0) #if (NUM_BUFFERS > 0)
uniform float m_MorphWeights[NUM_MORPH_TARGETS]; uniform float m_MorphWeights[NUM_MORPH_TARGETS];
@ -98,7 +96,7 @@ Note that it only handles morphing position, normals and tangents.
} }
float Get_Inverse_Weights_Sum(){ float Get_Inverse_Weights_Sum(){
float sum = 0; float sum = 0.0;
for( int i = 0;i < NUM_MORPH_TARGETS; i++){ for( int i = 0;i < NUM_MORPH_TARGETS; i++){
sum += m_MorphWeights[i]; sum += m_MorphWeights[i];
} }
@ -175,10 +173,10 @@ Note that it only handles morphing position, normals and tangents.
void Morph_Compute(inout vec4 pos){ void Morph_Compute(inout vec4 pos){
#if (NUM_TARGETS_BUFFERS == 2) #if (NUM_TARGETS_BUFFERS == 2)
Morph_Compute_Pos_Norm(pos,dummy_norm); Morph_Compute_Pos_Norm(pos,vec3(0.0));
return; return;
#elif (NUM_TARGETS_BUFFERS == 3) #elif (NUM_TARGETS_BUFFERS == 3)
Morph_Compute_Pos_Norm_Tan(pos, dummy_norm, dummy_tan); Morph_Compute_Pos_Norm_Tan(pos, vec3(0.0), vec3(0.0));
return; return;
#endif #endif
Morph_Compute_Pos(pos); Morph_Compute_Pos(pos);
@ -189,7 +187,7 @@ Note that it only handles morphing position, normals and tangents.
Morph_Compute_Pos(pos); Morph_Compute_Pos(pos);
return; return;
#elif (NUM_TARGETS_BUFFERS == 3) #elif (NUM_TARGETS_BUFFERS == 3)
Morph_Compute_Pos_Norm_Tan(pos, dummy_norm, dummy_tan); Morph_Compute_Pos_Norm_Tan(pos, vec3(0.0), vec3(0.0));
return; return;
#elif (NUM_TARGETS_BUFFERS == 2) #elif (NUM_TARGETS_BUFFERS == 2)
Morph_Compute_Pos_Norm(pos, norm); Morph_Compute_Pos_Norm(pos, norm);