* Commit new test tangent for lex

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8643 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 13 years ago
parent 3db3648866
commit 5440deeaeb
  1. BIN
      engine/src/test-data/Models/TangentBugs/test.blend
  2. BIN
      engine/src/test-data/Models/TangentBugs/test_normal.png
  3. 34
      engine/src/test/jme3test/light/TestTangentGenBadModels.java

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.shape.Sphere;
import com.jme3.light.DirectionalLight;
import com.jme3.math.Transform;
import com.jme3.scene.Mesh;
import com.jme3.scene.SceneGraphVisitorAdapter;
import com.jme3.util.TangentBinormalGenerator;
@ -33,11 +34,11 @@ public class TestTangentGenBadModels extends SimpleApplication {
@Override
public void simpleInitApp() {
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://jme-glsl-shaders.googlecode.com/hg/assets/Models/LightBlow/", UrlLocator.class);
// assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/", UrlLocator.class);
Geometry badModel = (Geometry) assetManager.loadModel("jme_lightblow.obj");
badModel.setLocalScale(2f);
Spatial badModel = assetManager.loadModel("Models/TangentBugs/test.blend");
// badModel.setLocalScale(1f);
// Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
// mat.setTexture("NormalMap", assetManager.loadTexture("jme_lightblow_nor.png"));
@ -50,6 +51,8 @@ public class TestTangentGenBadModels extends SimpleApplication {
// Spatial model = assetManager.loadModel("test.blend");
// rootNode.attachChild(model);
final Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m");
rootNode.depthFirstTraversal(new SceneGraphVisitorAdapter(){
@Override
public void visit(Geometry g){
@ -60,22 +63,19 @@ public class TestTangentGenBadModels extends SimpleApplication {
// mat.setTexture("DiffuseMap", null);
// }
TangentBinormalGenerator.generate(m);
Geometry debug = new Geometry(
"Debug Teapot",
TangentBinormalGenerator.genTbnLines(g.getMesh(), 0.2f)
);
debug.getMesh().setLineWidth(1);
debug.setMaterial(debugMat);
debug.setCullHint(Spatial.CullHint.Never);
debug.setLocalTransform(debug.getLocalTransform());
g.getParent().attachChild(debug);
}
});
Geometry debug = new Geometry(
"Debug Teapot",
TangentBinormalGenerator.genTbnLines(((Geometry) badModel).getMesh(), 0.03f)
);
debug.getMesh().setLineWidth(3);
Material debugMat = assetManager.loadMaterial("Common/Materials/VertexColor.j3m");
debug.setMaterial(debugMat);
debug.setCullHint(Spatial.CullHint.Never);
debug.getLocalTranslation().set(badModel.getLocalTranslation());
debug.getLocalScale().set(badModel.getLocalScale());
rootNode.attachChild(debug);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.8f, -0.6f, -0.08f).normalizeLocal());
dl.setColor(new ColorRGBA(1,1,1,1));

Loading…
Cancel
Save