When I add the jme3-core library which contains SimpleTextured.j3md file, the output show the error: SimpleTextured.j3md has been marked as obsolete. Please use Unshaded.j3md instead.
If I edit SimpleTextured.j3md to Unshaded.j3md, all textures are disappeared this is what I don’t want to see.
When I remove the jme3-core library, the output show the error: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.asset.AssetNotFoundException: Common/MatDefs/Misc/SimpleTextured.j3md
what is the problem? How to fix it?
Many thanks.
here is the full code download:
http://www.sendspace.com/file/fzhgvz
here is the main class of my code:
[java]
/* / package com.adamyocum.jme3.processing.test;
/ /
/ / import com.adamyocum.jme3.processing.api.JMEProcessingBox;
/ / import com.adamyocum.jme3.processing.api.JMEProcessingPicture;
/ / import com.adamyocum.processing.sketch.CubicGridSketch;
/ / import com.adamyocum.processing.sketch.KineticTypeSketch;
/ / import com.adamyocum.processing.sketch.RunAmuckSketch;
/ / import com.adamyocum.processing.sketch.WaveOptimized;
/ / import com.jme3.app.SimpleApplication;
/ / import com.jme3.app.state.AppStateManager;
/ / import com.jme3.asset.AssetManager;
/ / import com.jme3.asset.TextureKey;
/ / import com.jme3.bullet.BulletAppState;
/ / import com.jme3.bullet.BulletAppState.ThreadingType;
/ / import com.jme3.bullet.PhysicsSpace;
/ / import com.jme3.bullet.collision.shapes.SphereCollisionShape;
/ / import com.jme3.bullet.control.RigidBodyControl;
/ / import com.jme3.font.BitmapCharacterSet;
/ / import com.jme3.font.BitmapFont;
/ / import com.jme3.font.BitmapText;
/ / import com.jme3.input.InputManager;
/ / import com.jme3.input.controls.ActionListener;
/ / import com.jme3.input.controls.MouseButtonTrigger;
/ / import com.jme3.input.controls.Trigger;
/ / import com.jme3.material.Material;
/ / import com.jme3.math.Vector3f;
/ / import com.jme3.renderer.Camera;
/ / import com.jme3.renderer.ViewPort;
import com.jme3.renderer.queue.RenderQueue;
/ / import com.jme3.renderer.queue.RenderQueue.ShadowMode;
/ / import com.jme3.scene.Geometry;
/ / import com.jme3.scene.Node;
/ / import com.jme3.scene.shape.Box;
/ / import com.jme3.scene.shape.Sphere;
/ / import com.jme3.scene.shape.Sphere.TextureMode;
/ / import com.jme3.shadow.BasicShadowRenderer;
/ / import com.jme3.system.AppSettings;
/ / import com.jme3.texture.Texture;
/ / import com.jme3.texture.Texture.WrapMode;
/ / import com.jme3.ui.Picture;
/ / import java.io.PrintStream;
/ / import java.util.Date;
/ / import java.util.Random;
/ /
/ / public class RingTest extends SimpleApplication
/ / {
/ 50 / int bricksPerLayer = 30;
/ 51 / int brickLayers = 48;
/ / static final float brickWidth = 0.3F;
/ / static final float brickHeight = 0.25F;
/ / static final float brickDepth = 0.25F;
/ 53 / float radius = 30.0F;
/ 54 / float angle = 0.0F;
/ 55 / float randomMissFactor = 0.0F;
/ 56 / float missFactor = 0.0F;
/ 57 / Random r = new Random();
/ / Material mat;
/ / Material mat2;
/ / Material mat3;
/ / BasicShadowRenderer bsr;
/ 93 / private static final Sphere bullet = new Sphere(32, 32, 2.0F, true, false);
/ /
/ 97 / private static final Box brick = new Box(Vector3f.ZERO, 0.3F, 0.25F, 0.25F);
/ / private static final SphereCollisionShape bulletCollisionShape;
/ / JMEProcessingPicture picture1;
/ / JMEProcessingPicture picture2;
/ / JMEProcessingPicture picture3;
/ / Geometry geom;
/ / CubicGridSketch cubicGridSketch;
/ / JMEProcessingBox pBackboard;
/ / Picture HUD2;
/ / Picture HUD3;
/ / WaveOptimized waveOptimized;
/ 74 / long now = 0L;
/ 75 / long lastTargetChange = new Date().getTime();
/ 76 / long stepLast = new Date().getTime();
/ 77 / boolean rightleft = true;
/ 78 / long timeBetweenSwitching = 5000L;
/ 79 / long timeBetweenSteps = this.timeBetweenSwitching / 100L;
/ 80 / long timeBetweenClockTicks = 500L;
/ 81 / long clockTickLast = new Date().getTime();
/ 82 / int stepRight = 1;
/ 83 / int stepLeft = 1;
/ 84 / Vector3f aimLocation = null;
/ 85 / Vector3f camLocation = null;
/ 86 / long gameTime = 50000L;
/ 87 / long gameStart = new Date().getTime();
/ / BitmapText aTimer;
/ / Picture picture;
/ / RunAmuckSketch runAmuckSketchHUD;
/ / private BulletAppState bulletAppState;
/ 137 / private ActionListener actionListener = new ActionListener()
/ / {
/ / public void onAction(String name, boolean keyPressed, float tpf) {
/ 140 / if ((name.equals(“shoot”)) && (!keyPressed)) {
/ 141 / Geometry bulletg = new Geometry(“bullet”, RingTest.bullet);
/ 142 / bulletg.setMaterial(RingTest.this.mat2);
/ 143 / bulletg.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
/ 144 / bulletg.setLocalTranslation(RingTest.this.aimLocation.add(new Vector3f(0.0F, 0.0F, 0.0F)));
/ /
/ 146 / RigidBodyControl bulletNode = new RigidBodyControl(RingTest.bulletCollisionShape, 0.2F);
/ 147 / System.out.println(“RANDOM MISS FACTOR:” + RingTest.this.missFactor);
/ /
/ 149 / bulletNode.setLinearVelocity(RingTest.this.cam.getDirection().add(new Vector3f(RingTest.this.missFactor, 0.0F, 0.0F)).mult(new Vector3f(RingTest.this.cam.getDirection().getX() + 25.0F, RingTest.this.cam.getDirection().getY() + 75.0F, RingTest.this.cam.getDirection().getZ() + 25.0F)));
/ 150 / bulletNode.setAngularVelocity(new Vector3f(3.0F, 0.0F, 0.0F));
/ 151 / bulletg.addControl(bulletNode);
/ 152 / RingTest.this.rootNode.attachChild(bulletg);
/ 153 / RingTest.this.getPhysicsSpace().add(bulletNode);
/ / }
/ / }
/ 137 / };
/ / KineticTypeSketch kineticTypeSketch;
/ / JMEProcessingBox pAim;
/ /
/ / public static void main(String[] args)
/ / {
/ 102 / RingTest f = new RingTest();
/ 103 / f.start();
/ / }
/ /
/ / public void simpleInitApp()
/ / {
/ 108 / this.picture1 = new JMEProcessingPicture(this);
/ 109 / this.picture2 = new JMEProcessingPicture(this);
/ 110 / this.picture3 = new JMEProcessingPicture(this);
/ 111 / this.bulletAppState = new BulletAppState();
/ 112 / this.bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
/ 113 / this.stateManager.attach(this.bulletAppState);
/ 114 / initMaterial();
/ 115 / initBackboard();
/ 116 / initHUD();
/ /
/ 119 / this.runAmuckSketchHUD.materialToTexturize = this.mat2;
/ 120 / initTower();
/ 121 / initCrossHairs();
/ 122 / this.cam.setLocation(new Vector3f(0.0F, 5.0F, 50.0F));
/ 123 / this.cam.lookAt(Vector3f.ZERO, new Vector3f(0.0F, 1.0F, 0.0F));
/ 124 / this.cam.setFrustumFar(100.0F);
/ 125 / this.inputManager.addMapping(“shoot”, new Trigger[] { new MouseButtonTrigger(0) });
/ 126 / this.inputManager.addListener(this.actionListener, new String[] { “shoot” });
/ /
/ 128 / this.rootNode.setShadowMode(RenderQueue.ShadowMode.Off);
/ 129 / this.bsr = new BasicShadowRenderer(assetManager, 256);
/ 130 / this.bsr.setDirection(new Vector3f(-1.0F, -1.0F, -1.0F).normalizeLocal());
/ 131 / this.viewPort.addProcessor(this.bsr);
/ / }
/ /
/ / private PhysicsSpace getPhysicsSpace() {
/ 135 / return this.bulletAppState.getPhysicsSpace();
/ / }
/ /
/ / public void initTower()
/ / {
/ 159 / double tempX = 0.0D;
/ 160 / double tempY = 0.0D;
/ 161 / double tempZ = 0.0D;
/ 162 / this.angle = 0.0F;
/ 163 / for (int i = 0; i < this.brickLayers; i++)
/ / {
/ 165 / tempY += 0.25D;
/ /
/ 167 / this.angle = (360.0F / this.bricksPerLayer * i / 2.0F);
/ 168 / for (int j = 0; j < this.bricksPerLayer; j++) {
/ 169 / tempZ = Math.cos(Math.toRadians(this.angle)) * this.radius;
/ 170 / tempX = Math.sin(Math.toRadians(this.angle)) * this.radius;
/ /
/ 172 / Vector3f vt = new Vector3f((float)(tempX / 10.0D), (float)tempY, (float)(tempZ / 10.0D));
/ 173 / if (i > this.brickLayers - 4) {
/ 174 / addBrick(vt);
/ / }
/ /
/ 177 / this.angle = ((float)(this.angle + 360.0D / this.bricksPerLayer));
/ / }
/ / }
/ / }
/ /
/ / public void initBackboard()
/ / {
/ 184 / this.pBackboard = new JMEProcessingBox(this, new Vector3f(8.0F, 8.0F, 0.1F));
/ 185 / this.cubicGridSketch = new CubicGridSketch(this.pBackboard);
/ 186 / this.cubicGridSketch.init();
/ 187 / Geometry geom = this.pBackboard.getGeometry();
/ 188 / geom.setShadowMode(RenderQueue.ShadowMode.Receive);
/ 189 / geom.setLocalTranslation(0.0F, 17.0F, -3.0F);
/ 190 / geom.addControl(new RigidBodyControl(0.0F));
/ 191 / this.rootNode.attachChild(geom);
/ 192 / getPhysicsSpace().add(geom);
/ / }
/ /
/ / public void initHUD()
/ / {
/ 197 / this.picture = this.picture1.getPicture();
/ 198 / this.picture.setPosition(0.0F, this.settings.getHeight() - this.settings.getHeight() / 4);
/ 199 / this.picture.setWidth(this.settings.getWidth() / 4);
/ 200 / this.picture.setHeight(this.settings.getHeight() / 4);
/ 201 / this.runAmuckSketchHUD = new RunAmuckSketch(this.picture1);
/ 202 / this.runAmuckSketchHUD.init();
/ 203 / this.rootNode.attachChild(this.picture);
/ / }
/ /
/ / public void initHUD3()
/ / {
/ 217 / this.HUD3 = this.picture3.getPicture();
/ 218 / this.HUD3.setPosition(0.0F, this.settings.getHeight() - this.settings.getHeight() / 4 * 2);
/ 219 / this.HUD3.setWidth(this.settings.getWidth() / 4);
/ 220 / this.HUD3.setHeight(this.settings.getHeight() / 4);
/ 221 / this.kineticTypeSketch = new KineticTypeSketch(this.picture3);
/ 222 / this.kineticTypeSketch.init();
/ 223 / this.rootNode.attachChild(this.HUD3);
/ / }
/ /
/ / public void initMaterial() {
/ 227 / System.out.println("!!!InitMaterial!!!");
/ 228 / this.mat = new Material(assetManager, “Common/MatDefs/Misc/SimpleTextured.j3md”);
/ 229 / TextureKey key = new TextureKey(“Textures/Terrain/BrickWall/BrickWall.jpg”);
/ 230 / key.setGenerateMips(true);
/ 231 / Texture tex = assetManager.loadTexture(key);
/ 232 / this.mat.setTexture(“ColorMap”, tex);
/ /
/ 234 / this.mat2 = new Material(assetManager, “Common/MatDefs/Misc/SimpleTextured.j3md”);
/ 235 / TextureKey key2 = new TextureKey(“Textures/Terrain/Pond/Pond.png”);
/ 236 / key2.setGenerateMips(true);
/ 237 / Texture tex2 = assetManager.loadTexture(key2);
/ 238 / this.mat2.setTexture(“ColorMap”, tex2);
/ /
/ 240 / this.mat3 = new Material(assetManager, “Common/MatDefs/Misc/SimpleTextured.j3md”);
/ 241 / TextureKey key3 = new TextureKey(“Textures/Terrain/Pond/Pond.png”);
/ 242 / key3.setGenerateMips(true);
/ 243 / Texture tex3 = assetManager.loadTexture(key3);
/ 244 / tex3.setWrap(Texture.WrapMode.Repeat);
/ 245 / this.mat3.setTexture(“ColorMap”, tex3);
/ / }
/ /
/ / public void simpleUpdate(float tpf)
/ / {
/ 251 / long diffClockTick = this.now - this.clockTickLast;
/ 252 / if (diffClockTick > this.timeBetweenClockTicks) {
/ 253 / long gameLength = new Date().getTime() - this.gameStart;
/ /
/ 255 / if (this.gameTime < gameLength) {
/ 256 / this.aTimer.setText(“Game Over!!”);
/ / } else {
/ 258 / double timeLeft = this.gameTime - gameLength;
/ 259 / this.aTimer.setText("" + (int)timeLeft / 1000);
/ / }
/ /
/ / }
/ /
/ 264 / this.now = new Date().getTime();
/ /
/ 266 / long diff = this.now - this.lastTargetChange;
/ 267 / if (diff > this.timeBetweenSwitching) {
/ 268 / if (this.rightleft) {
/ 269 / this.randomMissFactor = (this.r.nextFloat() / 10.0F);
/ 270 / this.rightleft = false;
/ / } else {
/ 272 / this.randomMissFactor = (-this.r.nextFloat() / 10.0F);
/ 273 / this.rightleft = true;
/ / }
/ 275 / this.lastTargetChange = this.now;
/ 276 / this.stepRight = 1;
/ 277 / this.stepLeft = 50;
/ / }
/ /
/ 280 / long diffStep = this.now - this.stepLast;
/ 281 / if (diffStep > this.timeBetweenSteps)
/ / {
/ 283 / if (this.stepRight < 45) {
/ 284 / this.aimLocation = new Vector3f(0.0F, 5.0F, 50.0F).add(new Vector3f(this.stepRight * (this.randomMissFactor / 25.0F), -2.0F, -1.5F));
/ 285 / this.geom.setLocalTranslation(this.aimLocation);
/ 286 / this.missFactor = this.aimLocation.getX();
/ /
/ 289 / this.stepRight += 1;
/ / } else {
/ 291 / this.aimLocation = this.aimLocation.add(new Vector3f(-(this.randomMissFactor / 25.0F), 0.0F, 0.0F));
/ 292 / this.geom.setLocalTranslation(this.aimLocation);
/ 293 / this.missFactor = this.aimLocation.getX();
/ /
/ 295 / this.stepLeft -= 1;
/ / }
/ /
/ 298 / this.stepLast = this.now;
/ / }
/ / }
/ /
/ / public void addBrick(Vector3f ori)
/ / {
/ 306 / Geometry reBoxg = new Geometry(“brick”, brick);
/ 307 / reBoxg.setMaterial(this.mat3);
/ 308 / reBoxg.setLocalTranslation(ori);
/ 309 / reBoxg.rotate(0.0F, (float)Math.toRadians(this.angle), 0.0F);
/ 310 / reBoxg.addControl(new RigidBodyControl(0.0F));
/ 311 / reBoxg.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
/ 312 / ((RigidBodyControl)reBoxg.getControl(RigidBodyControl.class)).setFriction(0.6F);
/ 313 / this.rootNode.attachChild(reBoxg);
/ 314 / getPhysicsSpace().add(reBoxg);
/ / }
/ /
/ / protected void initCrossHairs()
/ / {
/ 319 / this.aTimer = new BitmapText(this.guiFont, false);
/ 320 / this.aTimer.setSize(this.guiFont.getCharSet().getRenderedSize() * 2);
/ 321 / this.aTimer.setText(“50.000”);
/ 322 / this.aTimer.setLocalTranslation(this.settings.getWidth() - 200, this.settings.getHeight() - 20, 0.0F);
/ /
/ 325 / this.guiNode.attachChild(this.aTimer);
/ /
/ 327 / this.guiFont = assetManager.loadFont(“Interface/Fonts/Default.fnt”);
/ 328 / BitmapText ch = new BitmapText(this.guiFont, false);
/ 329 / ch.setSize(this.guiFont.getCharSet().getRenderedSize() * 2);
/ 330 / ch.setText("+");
/ 331 / ch.setLocalTranslation(this.settings.getWidth() / 2 - this.guiFont.getCharSet().getRenderedSize() / 3 * 2, this.settings.getHeight() / 2 + ch.getLineHeight() / 2.0F, 0.0F);
/ /
/ 334 / this.guiNode.attachChild(ch);
/ /
/ 336 / Box pBox = new Box(Vector3f.ZERO, new Vector3f(0.15F, 2.0F, 0.15F));
/ 337 / this.geom = new Geometry(“pBox”, pBox);
/ 338 / this.geom.setMaterial(this.mat3);
/ 339 / this.geom.setShadowMode(RenderQueue.ShadowMode.Receive);
/ 340 / this.geom.setLocalTranslation(this.cam.getLocation().add(new Vector3f(0.0F, -2.0F, -1.5F)));
/ 341 / this.aimLocation = this.cam.getLocation().add(new Vector3f(0.0F, -2.0F, -1.5F));
/ 342 / this.rootNode.attachChild(this.geom);
/ / }
/ /
/ / public void destroy()
/ / {
/ 348 / this.cubicGridSketch.exit();
/ /
/ 350 / this.runAmuckSketchHUD.exit();
/ / }
/ /
/ / static
/ / {
/ 94 / bullet.setTextureMode(Sphere.TextureMode.Projected);
/ 95 / bulletCollisionShape = new SphereCollisionShape(2.0F);
/ / }
/ */ }
/* Location: C:\Users\Y\Documents\NetBeansProjects\libs\ProcessingAndJME3\ProcessingAndJME3.jar
- Qualified Name: com.adamyocum.jme3.processing.test.RingTest
- JD-Core Version: 0.6.2
*/[/java]