• R/O
  • SSH

MMDLoaderJME: 提交

Java版MikuMikuDanceライブラリ


Commit MetaInfo

修訂8d7645c7fe628df1b5a1411e3e29eb6cddce7b6c (tree)
時間2012-09-02 03:40:08
作者Kazuhiko Kobayashi <chototsu_ <moushinp@yaho...>
CommiterKazuhiko Kobayashi <chototsu_

Log Message

Remove skinnb2.
Change skinvb Dynamic to Stream.

Change Summary

差異

diff -r 9449104c7492 -r 8d7645c7fe62 src/projectkyoto/jme3/mmd/PMDLoaderGLSLSkinning2.java
--- a/src/projectkyoto/jme3/mmd/PMDLoaderGLSLSkinning2.java Sun Aug 12 22:39:24 2012 +0900
+++ b/src/projectkyoto/jme3/mmd/PMDLoaderGLSLSkinning2.java Sun Sep 02 03:40:08 2012 +0900
@@ -92,7 +92,7 @@
9292 VertexBuffer skinvb;
9393 VertexBuffer skinvb2;
9494 VertexBuffer skinnb;
95- VertexBuffer skinnb2;
95+// VertexBuffer skinnb2;
9696 VertexBuffer skintb;
9797 VertexBuffer skinbib;
9898 VertexBuffer skinwb;
@@ -135,7 +135,7 @@
135135 skinvb = null;
136136 skinvb2 = null;
137137 skinnb = null;
138- skinnb2 = null;
138+// skinnb2 = null;
139139 skintb = null;
140140 skeletonControl = null;
141141 skinArray = null;
@@ -232,9 +232,9 @@
232232 FloatBuffer skinnfb = BufferUtils.createFloatBuffer(meshConverter.getSkinMeshData().getVertexList().size() * 3);
233233 skinnb.setupData(VertexBuffer.Usage.Static, 3, VertexBuffer.Format.Float, skinnfb);
234234
235- skinnb2 = new VertexBuffer(VertexBuffer.Type.Normal);
236- FloatBuffer skinnfb2 = BufferUtils.createFloatBuffer(meshConverter.getSkinMeshData().getVertexList().size() * 3);
237- skinnb2.setupData(VertexBuffer.Usage.Static, 3, VertexBuffer.Format.Float, skinnfb2);
235+// skinnb2 = new VertexBuffer(VertexBuffer.Type.Normal);
236+// FloatBuffer skinnfb2 = BufferUtils.createFloatBuffer(meshConverter.getSkinMeshData().getVertexList().size() * 3);
237+// skinnb2.setupData(VertexBuffer.Usage.Static, 3, VertexBuffer.Format.Float, skinnfb2);
238238
239239 skintb = new VertexBuffer(VertexBuffer.Type.TexCoord);
240240 FloatBuffer skintfb = BufferUtils.createFloatBuffer(meshConverter.getSkinMeshData().getVertexList().size() * 2);
@@ -275,8 +275,8 @@
275275 skinvfb2.position(0);
276276 skinvfb2.put(skinvfb);
277277 skinnfb.position(0);
278- skinnfb2.position(0);
279- skinnfb2.put(skinnfb);
278+// skinnfb2.position(0);
279+// skinnfb2.put(skinnfb);
280280 skinIndexArray = new int[meshConverter.getSkinMeshData().getBoneList().size()];
281281 for (int i = 0; i < skinIndexArray.length; i++) {
282282 if (i < meshConverter.getSkinMeshData().getBoneList().size()) {
@@ -298,7 +298,7 @@
298298 mesh.setBuffer(skinvb);
299299 mesh.setSkinvb2(skinvb2);
300300 mesh.setBuffer(skinnb);
301- mesh.setSkinnb2(skinnb2);
301+// mesh.setSkinnb2(skinnb2);
302302 if (textureFlag) {
303303 mesh.setBuffer(skintb);
304304 }
diff -r 9449104c7492 -r 8d7645c7fe62 src/projectkyoto/jme3/mmd/PMDNode.java
--- a/src/projectkyoto/jme3/mmd/PMDNode.java Sun Aug 12 22:39:24 2012 +0900
+++ b/src/projectkyoto/jme3/mmd/PMDNode.java Sun Sep 02 03:40:08 2012 +0900
@@ -59,6 +59,7 @@
5959 import com.jme3.scene.shape.Box;
6060 import com.jme3.shader.VarType;
6161 import com.jme3.util.BufferUtils;
62+import java.nio.Buffer;
6263 import java.nio.ShortBuffer;
6364 import java.util.Arrays;
6465 import java.util.HashMap;
@@ -150,13 +151,13 @@
150151 skinMesh.setBuffer(skinvb);
151152 skinMesh.setSkinvb2(skinvb2);
152153 skinMesh.setBuffer(skinnb);
153- skinMesh.setSkinnb2(skinnb2);
154+// skinMesh.setSkinnb2(skinnb2);
154155 skinMesh.setBuffer(skintb);
155156 } else {
156157 skinMesh.setBuffer(skinvb);
157158 skinMesh.setSkinvb2(skinvb2);
158159 skinMesh.setBuffer(skinnb);
159- skinMesh.setSkinnb2(skinnb2);
160+// skinMesh.setSkinnb2(skinnb2);
160161 skinMesh.setBuffer(skintb);
161162 }
162163 skinTargets[skinMeshCount++] = (PMDSkinMesh)mesh;
@@ -211,7 +212,7 @@
211212 if (skinTargets != null && skinTargets.length > 0) {
212213 PMDSkinMesh mesh = skinTargets[0];
213214 c.write(mesh.getSkinvb2(),"skinvb",null);
214- c.write(mesh.getSkinnb2(),"skinnb",null);
215+// c.write(mesh.getSkinnb2(),"skinnb",null);
215216 c.write(mesh.getBuffer(Type.TexCoord),"skintb",null);
216217 }
217218 c.write(skinArray, "skinArray", null);
@@ -401,17 +402,18 @@
401402 // VertexBuffer nb = skinTargets[0].getBuffer(VertexBuffer.Type.Normal);
402403 skinTargets[0].skinvb2.setUpdateNeeded();
403404 // skinTargets[0].skinnb2.setUpdateNeeded();
405+ VertexBuffer skinvb2 = skinTargets[0].skinvb2;
404406 for(PMDSkinMesh skinMesh : skinTargets) {
405407 // skinMesh.clearBuffer(Type.Position);
406408 // skinMesh.clearBuffer(Type.Normal);
407- skinMesh.setBuffer(skinTargets[0].getSkinvb2());
409+ skinMesh.setBuffer(skinvb2);
408410 // skinMesh.setBuffer(skinTargets[0].getSkinnb2());
409411 }
410412 skinTargets[0].skinvb2 = vb;
411413 // skinTargets[0].skinnb2 = nb;
412- vb = skinTargets[0].getBuffer(VertexBuffer.Type.Position);
414+// vb = skinTargets[0].getBuffer(VertexBuffer.Type.Position);
413415 // nb = skinTargets[0].getBuffer(VertexBuffer.Type.Normal);
414- vb.setUpdateNeeded();
416+// vb.setUpdateNeeded();
415417 // nb.setUpdateNeeded();
416418 }
417419 private void softwareSkinUpdate(PMDMesh mesh){
@@ -599,8 +601,8 @@
599601 void resetToBindSkinBackData(PMDSkinMesh mesh) {
600602 VertexBuffer vb = mesh.getSkinvb2(); // mesh.getBuffer(VertexBuffer.Type.Position);
601603 FloatBuffer vfb = (FloatBuffer) vb.getData();
602- VertexBuffer nb = mesh.getSkinnb2(); //mesh.getBuffer(VertexBuffer.Type.Normal);
603- FloatBuffer nfb = (FloatBuffer) nb.getData();
604+// VertexBuffer nb = mesh.getSkinnb2(); //mesh.getBuffer(VertexBuffer.Type.Normal);
605+// FloatBuffer nfb = (FloatBuffer) nb.getData();
604606
605607 VertexBuffer bvb = mesh.getBuffer(VertexBuffer.Type.BindPosePosition);
606608 FloatBuffer bvfb = (FloatBuffer) bvb.getData();
@@ -610,11 +612,11 @@
610612 for (int i = 0; i < vfb.capacity(); i++) {
611613 vfb.put(i, bvfb.get(i));
612614 }
613- for (int i = 0; i < nfb.capacity(); i++) {
614- nfb.put(i, bnfb.get(i));
615- }
615+// for (int i = 0; i < nfb.capacity(); i++) {
616+// nfb.put(i, bnfb.get(i));
617+// }
616618 vb.setUpdateNeeded();
617- nb.setUpdateNeeded();
619+// nb.setUpdateNeeded();
618620 }
619621 public Set<String> getSkinSet() {
620622 return skinMap.keySet();
@@ -896,7 +898,7 @@
896898 skinMesh.setBuffer(skinMesh0.getBuffer(Type.Position));
897899 skinMesh.setSkinvb2(skinMesh0.getSkinvb2());
898900 skinMesh.setBuffer(skinMesh0.getBuffer(Type.Normal));
899- skinMesh.setSkinnb2(skinMesh0.getSkinnb2());
901+// skinMesh.setSkinnb2(skinMesh0.getSkinnb2());
900902 if (skinMesh0.getBuffer(Type.TexCoord) != null)
901903 skinMesh.setBuffer(skinMesh0.getBuffer(Type.TexCoord));
902904 } else {
@@ -905,7 +907,7 @@
905907 skinMesh.setBuffer(skinMesh0.getBuffer(Type.Position).clone());
906908 skinMesh.setSkinvb2(skinMesh0.getSkinvb2().clone());
907909 skinMesh.setBuffer(skinMesh0.getBuffer(Type.Normal));
908- skinMesh.setSkinnb2(skinMesh0.getSkinnb2());
910+// skinMesh.setSkinnb2(skinMesh0.getSkinnb2());
909911 if (skinMesh0.getBuffer(Type.TexCoord) != null)
910912 skinMesh.setBuffer(skinMesh0.getBuffer(Type.TexCoord));
911913 }
diff -r 9449104c7492 -r 8d7645c7fe62 src/projectkyoto/jme3/mmd/PMDSkinMesh.java
--- a/src/projectkyoto/jme3/mmd/PMDSkinMesh.java Sun Aug 12 22:39:24 2012 +0900
+++ b/src/projectkyoto/jme3/mmd/PMDSkinMesh.java Sun Sep 02 03:40:08 2012 +0900
@@ -52,7 +52,7 @@
5252 int boneIndexArray[];
5353 Matrix4f boneMatrixArray[];
5454 VertexBuffer skinvb2;
55- VertexBuffer skinnb2;
55+// VertexBuffer skinnb2;
5656 int boneMatricesParamIndex = -1;
5757 ShortBuffer boneIndexBuffer;
5858 FloatBuffer boneMatrixBuffer;
@@ -76,13 +76,13 @@
7676 this.boneMatrixArray = boneMatrixArray;
7777 }
7878
79- public VertexBuffer getSkinnb2() {
80- return skinnb2;
81- }
82-
83- public void setSkinnb2(VertexBuffer skinnb2) {
84- this.skinnb2 = skinnb2;
85- }
79+// public VertexBuffer getSkinnb2() {
80+// return skinnb2;
81+// }
82+//
83+// public void setSkinnb2(VertexBuffer skinnb2) {
84+// this.skinnb2 = skinnb2;
85+// }
8686
8787 public VertexBuffer getSkinvb2() {
8888 return skinvb2;
@@ -120,26 +120,25 @@
120120 // newMesh.boneMatrixArray = new Matrix4f[boneMatrixArray.length];
121121 newMesh.skinvb2 = new VertexBuffer(VertexBuffer.Type.Position);
122122 FloatBuffer skinvfb2 = BufferUtils.clone((FloatBuffer)this.skinvb2.getData());
123- newMesh.skinvb2.setupData(VertexBuffer.Usage.Dynamic, 3, VertexBuffer.Format.Float, skinvfb2);
123+ newMesh.skinvb2.setupData(VertexBuffer.Usage.Stream, 3, VertexBuffer.Format.Float, skinvfb2);
124124
125- newMesh.skinnb2 = new VertexBuffer(VertexBuffer.Type.Normal);
126- FloatBuffer skinnfb2 = BufferUtils.clone((FloatBuffer)this.skinnb2.getData());
127- newMesh.skinnb2.setupData(VertexBuffer.Usage.Dynamic, 3, VertexBuffer.Format.Float, skinnfb2);
125+// newMesh.skinnb2 = new VertexBuffer(VertexBuffer.Type.Normal);
126+// FloatBuffer skinnfb2 = BufferUtils.clone((FloatBuffer)this.skinnb2.getData());
127+// newMesh.skinnb2.setupData(VertexBuffer.Usage.Static, 3, VertexBuffer.Format.Float, skinnfb2);
128128
129129 VertexBuffer skinvb1 = new VertexBuffer(VertexBuffer.Type.Position);
130130 // FloatBuffer skinvfb1 = BufferUtils.clone((FloatBuffer)this.skinvb2.getData());
131131 FloatBuffer skinvfb1 = BufferUtils.clone((FloatBuffer)this.getBuffer(VertexBuffer.Type.Position).getData());
132- skinvb1.setupData(VertexBuffer.Usage.Dynamic, 3, VertexBuffer.Format.Float, skinvfb1);
132+ skinvb1.setupData(VertexBuffer.Usage.Stream, 3, VertexBuffer.Format.Float, skinvfb1);
133133 newMesh.clearBuffer(VertexBuffer.Type.Position);
134134 newMesh.setBuffer(skinvb1);
135135
136- VertexBuffer skinnb1 = new VertexBuffer(VertexBuffer.Type.Normal);
136+// VertexBuffer skinnb1 = new VertexBuffer(VertexBuffer.Type.Normal);
137137 // FloatBuffer skinnfb1 = BufferUtils.clone((FloatBuffer)this.skinnb2.getData());
138- FloatBuffer skinnfb1 = BufferUtils.clone((FloatBuffer)this.getBuffer(VertexBuffer.Type.Normal).getData());
139- skinnb1.setupData(VertexBuffer.Usage.Dynamic, 3, VertexBuffer.Format.Float, skinnfb1);
140- newMesh.clearBuffer(VertexBuffer.Type.Normal);
141- newMesh.setBuffer(skinnb1);
142-
138+// FloatBuffer skinnfb1 = BufferUtils.clone((FloatBuffer)this.getBuffer(VertexBuffer.Type.Normal).getData());
139+// skinnb1.setupData(VertexBuffer.Usage.Stream, 3, VertexBuffer.Format.Float, skinnfb1);
140+// newMesh.clearBuffer(VertexBuffer.Type.Normal);
141+// newMesh.setBuffer(skinnb1);
143142 return newMesh;
144143 }
145144
Show on old repository browser