Main repository of MikuMikuStudio
Revision | 59970fe4ee62049579eeda1314a83e87244a371d (tree) |
---|---|
Time | 2013-05-16 23:11:17 |
Author | Kazuhiko Kobayashi <chototsu_moushinp@yaho...> |
Commiter | Kazuhiko Kobayashi |
Fix texture bug.(Tram girl support)
@@ -97,6 +97,7 @@ public class PMDLoaderGLSLSkinning2 implements AssetLoader{ | ||
97 | 97 | SkeletonControl skeletonControl; |
98 | 98 | HashMap<String, Texture> textureMap = new HashMap<String, Texture>(); |
99 | 99 | public static final Logger logger = Logger.getLogger(PMDLoaderGLSLSkinning2.class.getName()); |
100 | + public static boolean interleaveEnabled = true; | |
100 | 101 | public PMDLoaderGLSLSkinning2() { |
101 | 102 | } |
102 | 103 | public PMDLoaderGLSLSkinning2(AssetManager assetManager, PMDModel model) { |
@@ -164,7 +165,9 @@ public class PMDLoaderGLSLSkinning2 implements AssetLoader{ | ||
164 | 165 | node.pmdGeometryArray[pmdGeometryIndex++] = geom; |
165 | 166 | meshConverter.getMeshDataList().set(i, null); |
166 | 167 | // go.add(mesh); |
167 | - mesh.setInterleaved(); | |
168 | + if (interleaveEnabled) { | |
169 | + mesh.setInterleaved(); | |
170 | + } | |
168 | 171 | } |
169 | 172 | // go.optimize3(); |
170 | 173 | createSkinCommonVertData(); |
@@ -425,15 +428,15 @@ public class PMDLoaderGLSLSkinning2 implements AssetLoader{ | ||
425 | 428 | } |
426 | 429 | s = s.toLowerCase(); |
427 | 430 | if (s.equals("spa")) { |
428 | -// texture.setWrap(Texture.WrapMode.Repeat); | |
431 | + texture.setWrap(Texture.WrapMode.Repeat); | |
429 | 432 | texture.setMinFilter(Texture.MinFilter.BilinearNoMipMaps); |
430 | 433 | mat.setTexture("SphereMap_A", texture); |
431 | 434 | } else if (s.equals("sph")) { |
432 | -// texture.setWrap(Texture.WrapMode.Repeat); | |
435 | + texture.setWrap(Texture.WrapMode.Repeat); | |
433 | 436 | texture.setMinFilter(Texture.MinFilter.BilinearNoMipMaps); |
434 | 437 | mat.setTexture("SphereMap_H", texture); |
435 | 438 | } else { |
436 | -// texture.setWrap(Texture.WrapMode.Repeat); | |
439 | + texture.setWrap(Texture.WrapMode.Repeat); | |
437 | 440 | mat.setTexture("DiffuseMap", texture); |
438 | 441 | } |
439 | 442 | } |
@@ -30,6 +30,7 @@ | ||
30 | 30 | package projectkyoto.jme3.mmd; |
31 | 31 | |
32 | 32 | import com.jme3.bounding.BoundingBox; |
33 | +import com.jme3.bounding.BoundingSphere; | |
33 | 34 | import com.jme3.bounding.BoundingVolume; |
34 | 35 | import com.jme3.export.InputCapsule; |
35 | 36 | import com.jme3.export.JmeExporter; |
@@ -78,10 +79,15 @@ public class PMDMesh extends Mesh { | ||
78 | 79 | public void setBoneMatrixArray(Matrix4f[] boneMatrixArray) { |
79 | 80 | this.boneMatrixArray = boneMatrixArray; |
80 | 81 | } |
81 | - BoundingVolume bound = new BoundingBox(Vector3f.ZERO, 20, 20, 20); | |
82 | +// BoundingVolume bound = new BoundingBox(Vector3f.ZERO, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); | |
83 | + BoundingVolume bound = new BoundingBox(Vector3f.ZERO, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); | |
82 | 84 | |
83 | 85 | @Override |
84 | 86 | public BoundingVolume getBound() { |
87 | + BoundingBox bb = (BoundingBox)super.getBound(); | |
88 | + BoundingBox bb2 = new BoundingBox(bb.getCenter(), bb.getXExtent()*2, bb.getYExtent()*2, | |
89 | + bb.getZExtent()*2); | |
90 | + BoundingBox bb3 = new BoundingBox(bb.getCenter().ZERO,5,5,5); | |
85 | 91 | return bound; |
86 | 92 | } |
87 | 93 |
@@ -108,11 +108,11 @@ public class PMDSkinMesh extends Mesh { | ||
108 | 108 | this.boneMatrixBuffer = boneMatrixBuffer; |
109 | 109 | } |
110 | 110 | |
111 | - BoundingVolume bound = new BoundingBox(Vector3f.ZERO, 20, 20, 20); | |
111 | + BoundingVolume bound = new BoundingBox(Vector3f.ZERO, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); | |
112 | 112 | |
113 | 113 | @Override |
114 | 114 | public BoundingVolume getBound() { |
115 | - return bound; | |
115 | + return bound; //super.getBound(); | |
116 | 116 | } |
117 | 117 | @Override |
118 | 118 | public synchronized PMDSkinMesh clone() { |
@@ -181,7 +181,7 @@ public class VMDControl extends AbstractControl { | ||
181 | 181 | continue; |
182 | 182 | } |
183 | 183 | motionMap.put(m.getBoneName(), motionList); |
184 | -logger.info("boneName = "+m.getBoneName()+" "+motionList.boneIndex+" "+motionList.bone); | |
184 | +//logger.info("boneName = "+m.getBoneName()+" "+motionList.boneIndex+" "+motionList.bone); | |
185 | 185 | PMDBone pmdBone = pmdNode.getPmdModel().getBoneList().getBones()[motionList.boneIndex]; |
186 | 186 | if (pmdBone.getBoneType() == 9) { |
187 | 187 | // FOLLOW_ROTATE |
@@ -229,7 +229,7 @@ logger.info("boneName = "+m.getBoneName()+" "+motionList.boneIndex+" "+motionLis | ||
229 | 229 | // System.out.print(" "); |
230 | 230 | // } |
231 | 231 | } |
232 | - System.out.println(); | |
232 | +// System.out.println(); | |
233 | 233 | for (VMDSkin skin : vmdFile.getSkinArray()) { |
234 | 234 | SkinList skinList = skinMap.get(skin.getSkinName()); |
235 | 235 | if (skinList == null) { |
@@ -385,9 +385,9 @@ logger.info("boneName = "+m.getBoneName()+" "+motionList.boneIndex+" "+motionLis | ||
385 | 385 | for (int i = pmdNode.getSkeleton().getBoneCount() - 1; i >= 0; i--) { |
386 | 386 | int i2 = i; //boneEnabled.length -1 - i; |
387 | 387 | if (boneEnabled[i2] == 1) { |
388 | - if (!pmdNode.getSkeleton().getBone(i).getName().equals(pmdNode.getPmdModel().getBoneList().getBones()[i2].getBoneName())) { | |
389 | - System.out.println("ERROR " + pmdNode.getSkeleton().getBone(i).getName() + " " + pmdNode.getPmdModel().getBoneList().getBones()[i2].getBoneName()); | |
390 | - } | |
388 | +// if (!pmdNode.getSkeleton().getBone(i).getName().equals(pmdNode.getPmdModel().getBoneList().getBones()[i2].getBoneName())) { | |
389 | +// System.out.println("ERROR " + pmdNode.getSkeleton().getBone(i).getName() + " " + pmdNode.getPmdModel().getBoneList().getBones()[i2].getBoneName()); | |
390 | +// } | |
391 | 391 | Bone bone = pmdNode.getSkeleton().getBone(i); |
392 | 392 | bone.getLocalRotation().loadIdentity(); |
393 | 393 | } |
@@ -602,7 +602,7 @@ logger.info("boneName = "+m.getBoneName()+" "+motionList.boneIndex+" "+motionLis | ||
602 | 602 | |
603 | 603 | public void setFixedPhysics(boolean fixedPhysics) { |
604 | 604 | this.fixedPhysics = fixedPhysics; |
605 | - logger.info("fixedPhysics = " + fixedPhysics); | |
605 | +// logger.info("fixedPhysics = " + fixedPhysics); | |
606 | 606 | } |
607 | 607 | |
608 | 608 | @Override |
@@ -220,11 +220,11 @@ public class MeshData { | ||
220 | 220 | // bnfb.put(v.getNormal().x).put(v.getNormal().y).put(v.getNormal().z); |
221 | 221 | if (textureFlag) { |
222 | 222 | float f1 = v.getUv().getU(); |
223 | - float f2 = v.getUv().getV(); | |
223 | + float f2 = 1f-v.getUv().getV(); | |
224 | 224 | // tfb.put(v.getUv().getU()).put(1f - v.getUv().getV()); |
225 | - f1 = f1 - FastMath.floor(f1); | |
226 | - f2 = f2 - FastMath.floor(f2); | |
227 | - f2 = 1 - f2; | |
225 | +// f1 = f1 - FastMath.floor(f1); | |
226 | +// f2 = f2 - FastMath.floor(f2); | |
227 | +// f2 = 1 - f2; | |
228 | 228 | tfb.put(f1).put(f2); |
229 | 229 | } |
230 | 230 | float weight = (float) v.getBoneWeight() / 100.0f; |
@@ -224,14 +224,14 @@ public class SkinMeshData implements Serializable { | ||
224 | 224 | skinvfb.put(v.getPos().x).put(v.getPos().y).put(v.getPos().z); |
225 | 225 | v.getNormal().normalize(); |
226 | 226 | skinnfb.put(v.getNormal().x).put(v.getNormal().y).put(v.getNormal().z); |
227 | - float f1 = v.getUv().getU(); | |
228 | - float f2 = v.getUv().getV(); | |
227 | +// float f1 = v.getUv().getU(); | |
228 | +// float f2 = v.getUv().getV(); | |
229 | 229 | // tfb.put(v.getUv().getU()).put(1f - v.getUv().getV()); |
230 | - f1 = f1 - FastMath.floor(f1); | |
231 | - f2 = f2 - FastMath.floor(f2); | |
232 | - f2 = 1 - f2; | |
233 | - skintfb.put(f1).put(f2); | |
234 | -// skintfb.put(v.getUv().getU()).put(1f - v.getUv().getV()); | |
230 | +// f1 = f1 - FastMath.floor(f1); | |
231 | +// f2 = f2 - FastMath.floor(f2); | |
232 | +// f2 = 1 - f2; | |
233 | +// skintfb.put(f1).put(f2); | |
234 | + skintfb.put(v.getUv().getU()).put(1f - v.getUv().getV()); | |
235 | 235 | // skinbisb.put((short) meshConverter.getSkinMeshData() |
236 | 236 | // .getBoneList().indexOf(v.getBoneNum1())) |
237 | 237 | // .put((short) meshConverter.getSkinMeshData() |