提交 8585eaff 编写于 作者: M Mr.doob

Merge branch 'dev' of https://github.com/ikerr/three.js into dev

......@@ -4381,8 +4381,6 @@ THREE.WebGLRenderer = function ( parameters ) {
skinning: material.skinning,
maxBones: maxBones,
useVertexTexture: _supportsBoneTextures && object && object.useVertexTexture,
boneTextureWidth: object && object.boneTextureWidth,
boneTextureHeight: object && object.boneTextureHeight,
morphTargets: material.morphTargets,
morphNormals: material.morphNormals,
......@@ -4541,6 +4539,18 @@ THREE.WebGLRenderer = function ( parameters ) {
}
if ( p_uniforms.boneTextureWidth !== null ) {
_gl.uniform1i( p_uniforms.boneTextureWidth, object.boneTextureWidth );
}
if ( p_uniforms.boneTextureHeight !== null ) {
_gl.uniform1i( p_uniforms.boneTextureHeight, object.boneTextureHeight );
}
} else {
if ( p_uniforms.boneGlobalMatrices !== null ) {
......@@ -5755,8 +5765,6 @@ THREE.WebGLRenderer = function ( parameters ) {
parameters.skinning ? "#define USE_SKINNING" : "",
parameters.useVertexTexture ? "#define BONE_TEXTURE" : "",
parameters.boneTextureWidth ? "#define N_BONE_PIXEL_X " + parameters.boneTextureWidth.toFixed( 1 ) : "",
parameters.boneTextureHeight ? "#define N_BONE_PIXEL_Y " + parameters.boneTextureHeight.toFixed( 1 ) : "",
parameters.morphTargets ? "#define USE_MORPHTARGETS" : "",
parameters.morphNormals ? "#define USE_MORPHNORMALS" : "",
......@@ -5922,6 +5930,8 @@ THREE.WebGLRenderer = function ( parameters ) {
if ( parameters.useVertexTexture ) {
identifiers.push( 'boneTexture' );
identifiers.push( 'boneTextureWidth' );
identifiers.push( 'boneTextureHeight' );
} else {
......
......@@ -1251,15 +1251,17 @@ THREE.ShaderChunk = {
"#ifdef BONE_TEXTURE",
"uniform sampler2D boneTexture;",
"uniform int boneTextureWidth;",
"uniform int boneTextureHeight;",
"mat4 getBoneMatrix( const in float i ) {",
"float j = i * 4.0;",
"float x = mod( j, N_BONE_PIXEL_X );",
"float y = floor( j / N_BONE_PIXEL_X );",
"float x = mod( j, float( boneTextureWidth ) );",
"float y = floor( j / float( boneTextureWidth ) );",
"const float dx = 1.0 / N_BONE_PIXEL_X;",
"const float dy = 1.0 / N_BONE_PIXEL_Y;",
"float dx = 1.0 / float( boneTextureWidth );",
"float dy = 1.0 / float( boneTextureHeight );",
"y = dy * ( y + 0.5 );",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册