Use VBOs for vertices, indices when using shaders; multiply vertices by
weights even if we only have one weight per vertex. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@232 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -49,8 +49,8 @@ void main ()
|
|||||||
|
|
||||||
// add up the vertex as transformed by each bone and scaled by each weight
|
// add up the vertex as transformed by each bone and scaled by each weight
|
||||||
#if BONES_PER_VERTEX == 1
|
#if BONES_PER_VERTEX == 1
|
||||||
vec4 skinVertex = boneTransforms[int(boneIndices)] * gl_Vertex;
|
vec4 skinVertex = boneTransforms[int(boneIndices)] * gl_Vertex * boneWeights;
|
||||||
vec4 skinNormal = boneTransforms[int(boneIndices)] * normal4;
|
vec4 skinNormal = boneTransforms[int(boneIndices)] * normal4 * boneWeights;
|
||||||
#else
|
#else
|
||||||
vec4 skinVertex = boneTransforms[int(boneIndices[0])] * gl_Vertex * boneWeights[0];
|
vec4 skinVertex = boneTransforms[int(boneIndices[0])] * gl_Vertex * boneWeights[0];
|
||||||
vec4 skinNormal = boneTransforms[int(boneIndices[0])] * normal4 * boneWeights[0];
|
vec4 skinNormal = boneTransforms[int(boneIndices[0])] * normal4 * boneWeights[0];
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ public class ModelMesh extends TriMesh
|
|||||||
TextureState tstate = tprov.getTexture(_emissiveMap);
|
TextureState tstate = tprov.getTexture(_emissiveMap);
|
||||||
emissiveTex = tstate.getTexture();
|
emissiveTex = tstate.getTexture();
|
||||||
emissiveTex.setApply(Texture.AM_BLEND);
|
emissiveTex.setApply(Texture.AM_BLEND);
|
||||||
emissiveTex.setBlendColor(ColorRGBA.white);
|
emissiveTex.getBlendColor().set(ColorRGBA.white);
|
||||||
}
|
}
|
||||||
_tstates = new TextureState[_textures.length];
|
_tstates = new TextureState[_textures.length];
|
||||||
for (int ii = 0; ii < _textures.length; ii++) {
|
for (int ii = 0; ii < _textures.length; ii++) {
|
||||||
|
|||||||
@@ -343,14 +343,8 @@ public class SkinMesh extends ModelMesh
|
|||||||
public void lockStaticMeshes (
|
public void lockStaticMeshes (
|
||||||
Renderer renderer, boolean useVBOs, boolean useDisplayLists)
|
Renderer renderer, boolean useVBOs, boolean useDisplayLists)
|
||||||
{
|
{
|
||||||
// we can use VBOs for color, texture, and indices
|
// we can use VBOs for color, texture, and indices if not using shaders
|
||||||
if (useVBOs && renderer.supportsVBO()) {
|
if (useVBOs && renderer.supportsVBO()) {
|
||||||
VBOInfo vboinfo = new VBOInfo(false);
|
|
||||||
vboinfo.setVBOColorEnabled(true);
|
|
||||||
vboinfo.setVBOTextureEnabled(true);
|
|
||||||
vboinfo.setVBOIndexEnabled(!_translucent);
|
|
||||||
setVBOInfo(vboinfo);
|
|
||||||
|
|
||||||
// use VBOs for shader attributes
|
// use VBOs for shader attributes
|
||||||
GLSLShaderObjectsState sstate = (GLSLShaderObjectsState)getRenderState(
|
GLSLShaderObjectsState sstate = (GLSLShaderObjectsState)getRenderState(
|
||||||
RenderState.RS_GLSL_SHADER_OBJECTS);
|
RenderState.RS_GLSL_SHADER_OBJECTS);
|
||||||
@@ -359,6 +353,14 @@ public class SkinMesh extends ModelMesh
|
|||||||
attrib.useVBO = true;
|
attrib.useVBO = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VBOInfo vboinfo = new VBOInfo(true);
|
||||||
|
if (sstate == null) {
|
||||||
|
vboinfo.setVBOVertexEnabled(false);
|
||||||
|
vboinfo.setVBONormalEnabled(false);
|
||||||
|
}
|
||||||
|
vboinfo.setVBOIndexEnabled(!_translucent);
|
||||||
|
setVBOInfo(vboinfo);
|
||||||
}
|
}
|
||||||
_useDisplayLists = useDisplayLists && !_translucent;
|
_useDisplayLists = useDisplayLists && !_translucent;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user