• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Main repository of MikuMikuStudio


Commit MetaInfo

Revision59970fe4ee62049579eeda1314a83e87244a371d (tree)
Time2013-05-16 23:11:17
AuthorKazuhiko Kobayashi <chototsu_moushinp@yaho...>
CommiterKazuhiko Kobayashi

Log Message

Fix texture bug.(Tram girl support)

Change Summary

Incremental Difference

--- a/src/projectkyoto/jme3/mmd/PMDLoaderGLSLSkinning2.java
+++ b/src/projectkyoto/jme3/mmd/PMDLoaderGLSLSkinning2.java
@@ -97,6 +97,7 @@ public class PMDLoaderGLSLSkinning2 implements AssetLoader{
9797 SkeletonControl skeletonControl;
9898 HashMap<String, Texture> textureMap = new HashMap<String, Texture>();
9999 public static final Logger logger = Logger.getLogger(PMDLoaderGLSLSkinning2.class.getName());
100+ public static boolean interleaveEnabled = true;
100101 public PMDLoaderGLSLSkinning2() {
101102 }
102103 public PMDLoaderGLSLSkinning2(AssetManager assetManager, PMDModel model) {
@@ -164,7 +165,9 @@ public class PMDLoaderGLSLSkinning2 implements AssetLoader{
164165 node.pmdGeometryArray[pmdGeometryIndex++] = geom;
165166 meshConverter.getMeshDataList().set(i, null);
166167 // go.add(mesh);
167- mesh.setInterleaved();
168+ if (interleaveEnabled) {
169+ mesh.setInterleaved();
170+ }
168171 }
169172 // go.optimize3();
170173 createSkinCommonVertData();
@@ -425,15 +428,15 @@ public class PMDLoaderGLSLSkinning2 implements AssetLoader{
425428 }
426429 s = s.toLowerCase();
427430 if (s.equals("spa")) {
428-// texture.setWrap(Texture.WrapMode.Repeat);
431+ texture.setWrap(Texture.WrapMode.Repeat);
429432 texture.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
430433 mat.setTexture("SphereMap_A", texture);
431434 } else if (s.equals("sph")) {
432-// texture.setWrap(Texture.WrapMode.Repeat);
435+ texture.setWrap(Texture.WrapMode.Repeat);
433436 texture.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
434437 mat.setTexture("SphereMap_H", texture);
435438 } else {
436-// texture.setWrap(Texture.WrapMode.Repeat);
439+ texture.setWrap(Texture.WrapMode.Repeat);
437440 mat.setTexture("DiffuseMap", texture);
438441 }
439442 }
--- a/src/projectkyoto/jme3/mmd/PMDMesh.java
+++ b/src/projectkyoto/jme3/mmd/PMDMesh.java
@@ -30,6 +30,7 @@
3030 package projectkyoto.jme3.mmd;
3131
3232 import com.jme3.bounding.BoundingBox;
33+import com.jme3.bounding.BoundingSphere;
3334 import com.jme3.bounding.BoundingVolume;
3435 import com.jme3.export.InputCapsule;
3536 import com.jme3.export.JmeExporter;
@@ -78,10 +79,15 @@ public class PMDMesh extends Mesh {
7879 public void setBoneMatrixArray(Matrix4f[] boneMatrixArray) {
7980 this.boneMatrixArray = boneMatrixArray;
8081 }
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);
8284
8385 @Override
8486 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);
8591 return bound;
8692 }
8793
--- a/src/projectkyoto/jme3/mmd/PMDSkinMesh.java
+++ b/src/projectkyoto/jme3/mmd/PMDSkinMesh.java
@@ -108,11 +108,11 @@ public class PMDSkinMesh extends Mesh {
108108 this.boneMatrixBuffer = boneMatrixBuffer;
109109 }
110110
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);
112112
113113 @Override
114114 public BoundingVolume getBound() {
115- return bound;
115+ return bound; //super.getBound();
116116 }
117117 @Override
118118 public synchronized PMDSkinMesh clone() {
--- a/src/projectkyoto/jme3/mmd/vmd/VMDControl.java
+++ b/src/projectkyoto/jme3/mmd/vmd/VMDControl.java
@@ -181,7 +181,7 @@ public class VMDControl extends AbstractControl {
181181 continue;
182182 }
183183 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);
185185 PMDBone pmdBone = pmdNode.getPmdModel().getBoneList().getBones()[motionList.boneIndex];
186186 if (pmdBone.getBoneType() == 9) {
187187 // FOLLOW_ROTATE
@@ -229,7 +229,7 @@ logger.info("boneName = "+m.getBoneName()+" "+motionList.boneIndex+" "+motionLis
229229 // System.out.print(" ");
230230 // }
231231 }
232- System.out.println();
232+// System.out.println();
233233 for (VMDSkin skin : vmdFile.getSkinArray()) {
234234 SkinList skinList = skinMap.get(skin.getSkinName());
235235 if (skinList == null) {
@@ -385,9 +385,9 @@ logger.info("boneName = "+m.getBoneName()+" "+motionList.boneIndex+" "+motionLis
385385 for (int i = pmdNode.getSkeleton().getBoneCount() - 1; i >= 0; i--) {
386386 int i2 = i; //boneEnabled.length -1 - i;
387387 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+// }
391391 Bone bone = pmdNode.getSkeleton().getBone(i);
392392 bone.getLocalRotation().loadIdentity();
393393 }
@@ -602,7 +602,7 @@ logger.info("boneName = "+m.getBoneName()+" "+motionList.boneIndex+" "+motionLis
602602
603603 public void setFixedPhysics(boolean fixedPhysics) {
604604 this.fixedPhysics = fixedPhysics;
605- logger.info("fixedPhysics = " + fixedPhysics);
605+// logger.info("fixedPhysics = " + fixedPhysics);
606606 }
607607
608608 @Override
--- a/src/projectkyoto/mmd/file/util2/MeshData.java
+++ b/src/projectkyoto/mmd/file/util2/MeshData.java
@@ -220,11 +220,11 @@ public class MeshData {
220220 // bnfb.put(v.getNormal().x).put(v.getNormal().y).put(v.getNormal().z);
221221 if (textureFlag) {
222222 float f1 = v.getUv().getU();
223- float f2 = v.getUv().getV();
223+ float f2 = 1f-v.getUv().getV();
224224 // 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;
228228 tfb.put(f1).put(f2);
229229 }
230230 float weight = (float) v.getBoneWeight() / 100.0f;
--- a/src/projectkyoto/mmd/file/util2/SkinMeshData.java
+++ b/src/projectkyoto/mmd/file/util2/SkinMeshData.java
@@ -224,14 +224,14 @@ public class SkinMeshData implements Serializable {
224224 skinvfb.put(v.getPos().x).put(v.getPos().y).put(v.getPos().z);
225225 v.getNormal().normalize();
226226 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();
229229 // 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());
235235 // skinbisb.put((short) meshConverter.getSkinMeshData()
236236 // .getBoneList().indexOf(v.getBoneNum1()))
237237 // .put((short) meshConverter.getSkinMeshData()