* Commit new test tangent for lex
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8643 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
3db3648866
commit
5440deeaeb
BIN
engine/src/test-data/Models/TangentBugs/test.blend
Normal file
BIN
engine/src/test-data/Models/TangentBugs/test.blend
Normal file
Binary file not shown.
BIN
engine/src/test-data/Models/TangentBugs/test_normal.png
Normal file
BIN
engine/src/test-data/Models/TangentBugs/test_normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 576 KiB |
@ -12,6 +12,7 @@ import com.jme3.scene.Geometry;
|
|||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.scene.shape.Sphere;
|
import com.jme3.scene.shape.Sphere;
|
||||||
import com.jme3.light.DirectionalLight;
|
import com.jme3.light.DirectionalLight;
|
||||||
|
import com.jme3.math.Transform;
|
||||||
import com.jme3.scene.Mesh;
|
import com.jme3.scene.Mesh;
|
||||||
import com.jme3.scene.SceneGraphVisitorAdapter;
|
import com.jme3.scene.SceneGraphVisitorAdapter;
|
||||||
import com.jme3.util.TangentBinormalGenerator;
|
import com.jme3.util.TangentBinormalGenerator;
|
||||||
@ -33,11 +34,11 @@ public class TestTangentGenBadModels extends SimpleApplication {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void simpleInitApp() {
|
public void simpleInitApp() {
|
||||||
assetManager.registerLocator("http://jme-glsl-shaders.googlecode.com/hg/assets/Models/LightBlow/", UrlLocator.class);
|
// assetManager.registerLocator("http://jme-glsl-shaders.googlecode.com/hg/assets/Models/LightBlow/", UrlLocator.class);
|
||||||
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/", UrlLocator.class);
|
// assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/", UrlLocator.class);
|
||||||
|
|
||||||
Geometry badModel = (Geometry) assetManager.loadModel("jme_lightblow.obj");
|
Spatial badModel = assetManager.loadModel("Models/TangentBugs/test.blend");
|
||||||
badModel.setLocalScale(2f);
|
// badModel.setLocalScale(1f);
|
||||||
|
|
||||||
// Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
|
// Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
|
||||||
// mat.setTexture("NormalMap", assetManager.loadTexture("jme_lightblow_nor.png"));
|
// mat.setTexture("NormalMap", assetManager.loadTexture("jme_lightblow_nor.png"));
|
||||||
@ -50,6 +51,8 @@ public class TestTangentGenBadModels extends SimpleApplication {
|
|||||||
// Spatial model = assetManager.loadModel("test.blend");
|
// Spatial model = assetManager.loadModel("test.blend");
|
||||||
// rootNode.attachChild(model);
|
// rootNode.attachChild(model);
|
||||||
|
|
||||||
|
final Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m");
|
||||||
|
|
||||||
rootNode.depthFirstTraversal(new SceneGraphVisitorAdapter(){
|
rootNode.depthFirstTraversal(new SceneGraphVisitorAdapter(){
|
||||||
@Override
|
@Override
|
||||||
public void visit(Geometry g){
|
public void visit(Geometry g){
|
||||||
@ -60,21 +63,18 @@ public class TestTangentGenBadModels extends SimpleApplication {
|
|||||||
// mat.setTexture("DiffuseMap", null);
|
// mat.setTexture("DiffuseMap", null);
|
||||||
// }
|
// }
|
||||||
TangentBinormalGenerator.generate(m);
|
TangentBinormalGenerator.generate(m);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Geometry debug = new Geometry(
|
Geometry debug = new Geometry(
|
||||||
"Debug Teapot",
|
"Debug Teapot",
|
||||||
TangentBinormalGenerator.genTbnLines(((Geometry) badModel).getMesh(), 0.03f)
|
TangentBinormalGenerator.genTbnLines(g.getMesh(), 0.2f)
|
||||||
);
|
);
|
||||||
debug.getMesh().setLineWidth(3);
|
debug.getMesh().setLineWidth(1);
|
||||||
|
|
||||||
Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m");
|
|
||||||
debug.setMaterial(debugMat);
|
debug.setMaterial(debugMat);
|
||||||
debug.setCullHint(Spatial.CullHint.Never);
|
debug.setCullHint(Spatial.CullHint.Never);
|
||||||
debug.getLocalTranslation().set(badModel.getLocalTranslation());
|
debug.setLocalTransform(debug.getLocalTransform());
|
||||||
debug.getLocalScale().set(badModel.getLocalScale());
|
g.getParent().attachChild(debug);
|
||||||
rootNode.attachChild(debug);
|
}
|
||||||
|
});
|
||||||
|
|
||||||
DirectionalLight dl = new DirectionalLight();
|
DirectionalLight dl = new DirectionalLight();
|
||||||
dl.setDirection(new Vector3f(-0.8f, -0.6f, -0.08f).normalizeLocal());
|
dl.setDirection(new Vector3f(-0.8f, -0.6f, -0.08f).normalizeLocal());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user