Milkshape loading error

theres something wrong with jME, Matrix4f is undergoing some stuff

cep21’s new Milkshape loader (non-ascii) altered the Matrix4f file which broke the ascii loader. This is currently being resolved, most likely the ascii loader will merge with the .ms3d loader. Until then, use .ms3d. The jmetest.renderer.loader.TestMilkLoader class should help you.

I just updated with the cvs (I had the latest jar download), But now I have a problem much worse than before…Using the same code, the background color shows, but then after about 100 updates it closes, but doesnt call cleanup and eclipse doesnt say anything about an exit code either…Im extending VariableTimestepGame, should I try using SimpleGame? I cant figure out whats wrong with it…

groan Ok, can you send me the code? Either post it here, or e-mail it? I’ll take a look and see if I can determine what the problem is.

heres the code:


import com.jme.system.*;
import com.jme.system.lwjgl.*;
import com.jme.input.*;
import com.jme.input.lwjgl.*;
import com.jme.renderer.*;
import com.jme.math.*;
import com.jme.renderer.lwjgl.*;
import com.jme.app.VariableTimestepGame;
import com.jme.scene.*;
import com.jme.bounding.*;
import com.jme.terrain.*;
import com.jme.terrain.util.*;
import com.jme.image.*;
import com.jme.util.*;
import com.jme.scene.state.*;
import com.jme.util.lwjgl.*;
import com.jme.light.*;
import javax.swing.*;
import java.io.*;
import com.jme.scene.Controller;
import com.jme.scene.model.Model;
import com.jme.scene.model.md2.*;
import com.jme.scene.model.msascii.MilkshapeASCIIModel;
import java.net.URL;
import com.jme.animation.DeformationJointController;
import com.jme.scene.model.ms3d.MilkLoader;
import com.jme.scene.model.ms3d.MilkAnimation;


public class Galactic extends VariableTimestepGame {
   
   private Camera cam;
   private LWJGLKeyInput keyboard;
   private InputHandler input;

    private Node scene;

    private TerrainBlock terrain;
    private com.jme.util.Timer timer;
   
   protected void update(float arg0) {
      System.out.println("Update: " + arg0);
      timer.update();
      keyboard.update();
      if(keyboard.isKeyDown(LWJGLKeyInput.KEY_ESCAPE))
            finish();
      
      input.update(timer.getTimePerFrame());
      scene.updateGeometricState(arg0, true);
      cam.update();
      System.out.println("Update Done");
   }

   protected void render(float arg0) {
      display.getRenderer().clearBuffers();
      display.getRenderer().draw(scene);
   }

   protected void initSystem() {
      try{
      display= DisplaySystem.getDisplaySystem(properties.getRenderer());
      display.createWindow(properties.getWidth(),properties.getHeight(),properties.getDepth(),properties.getFreq(),properties.getFullscreen());
        display.setTitle("Galactic");
        //display.setVSyncEnabled(true);
         
        ColorRGBA bgColor = new ColorRGBA(0f, 0f, 1f, 1f);
        display.getRenderer().setBackgroundColor(bgColor);
      }catch(JmeException e){
         System.exit(0);
      }
      
         cam =
             display.getRenderer().getCamera(
             properties.getWidth(),
             properties.getHeight());
         cam.setFrustumPerspective(45.0f,(float)display.getWidth()/(float)display.getHeight(), 1,1000);
         Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
         Vector3f left = new Vector3f( -1.0f, 0.0f, 0.0f);
         Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
         Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
         cam.setFrame(loc, left, up, dir);
         cam.update();
         display.getRenderer().setCamera(cam);

        keyboard = new LWJGLKeyInput();
        input = new FirstPersonHandler(this,cam,properties.getRenderer());
        input.setKeySpeed(50.0f);
        input.setMouseSpeed(0.2f);
        timer = new LWJGLTimer();
   }

   protected void initGame() {


        cam.setLocation(new Vector3f(64*5, 250, 64*5));
        cam.setDirection(new Vector3f(0,0,-1));
        cam.update();

        scene = new Node("Root Node");
        //scene.attachChild(t);
        cam.update();
       
        ZBufferState z = display.getRenderer().getZBufferState();
        z.setEnabled(true);
        z.setFunction(ZBufferState.CF_LEQUAL);
        scene.setRenderState(z);
       
        FogState fs = display.getRenderer().getFogState();
        fs.setEnabled(false);
        scene.setRenderState(fs);
       

        CullState cs = display.getRenderer().getCullState();
        cs.setCullMode(CullState.CS_BACK);
        cs.setEnabled(false);
        scene.setRenderState(cs);
       
        MidPointHeightMap m = new MidPointHeightMap(128,1.5f);
        terrain = new TerrainBlock("Terrain",m.getSize(),new Vector3f(5f,1f,5f),m.getHeightMap(),new Vector3f(0,0,0),false);
        terrain.setDetailTexture(1,4);
        terrain.setModelBound(new BoundingSphere());
        terrain.updateModelBound();
        ProceduralTextureGenerator pt = new ProceduralTextureGenerator(m);
            pt.addTexture(new ImageIcon("data/texture/dirt.png"),
                          -128, 0, 128);
            pt.addTexture(new ImageIcon("data/texture/grass.png"),
                  0,128,255);
            pt.addTexture(new ImageIcon("data/texture/snow.png"),
                  128,255,384);
                  


            pt.createTexture(512);
      TextureState ts = display.getRenderer().getTextureState();
        System.out.println("Texture Units: " + ts.getNumberOfUnits());
        ts.setEnabled(true);
        Texture t1 = TextureManager.loadTexture(
                pt.getImageIcon().getImage(),
                Texture.MM_LINEAR,
                Texture.FM_LINEAR, true, true);
            ts.setTexture(t1,0);
            Texture t2 = TextureManager.loadTexture(
                    "data/texture/detail.png",
                    Texture.MM_LINEAR,
                    Texture.FM_LINEAR, true, true);
                ts.setTexture(t2, 1);
                t2.setWrap(Texture.WM_WRAP_S_WRAP_T);
               

                t1.setApply(Texture.AM_COMBINE);
                t1.setCombineFuncRGB(Texture.ACF_MODULATE);
                t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);
                t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
                t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
                t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
                t1.setCombineScaleRGB(0);

                t2.setApply(Texture.AM_COMBINE);
                t2.setCombineFuncRGB(Texture.ACF_ADD_SIGNED);
                t2.setCombineSrc0RGB(Texture.ACS_TEXTURE);
                t2.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
                t2.setCombineSrc1RGB(Texture.ACS_PREVIOUS);
                t2.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
                t2.setCombineScaleRGB(0);
        scene.attachChild(terrain);
        terrain.setRenderState(ts);

        cam.update();
        scene.setForceView(true);

        scene.updateGeometricState(0.0f, true);
        scene.updateRenderState();
   }

   protected void reinit() {
      // TODO Auto-generated method stub
   }

   protected void cleanup() {
      System.out.println("FPS: "+ timer.getFrameRate());
      keyboard.destroy();
   }
   public static void main(String[] args) {
      Galactic app = new Galactic();
      app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
      app.start();
   }
}

So, this problem exists without attempting to load the milkshape model at all? Running it now with eclispse…

Yep, I removed the milkshape stuff to make sure none of that was causing it. The code here works with the current jar you download on the website, but using the jar I built from the cvs has the problem…

Ran fine on my end. Was up for a few minutes (while I searched for a screencapture tool in linux).







EDIT: The only change I made to your code, was point to different textures (I didn’t have the ones you pointed to)

aaah, redhat, the devil of all linux! :wink:

I still cant get it to work with the cvs version…can you use the jme.jar in the target directory directly (Not use ant to rebuild it?) I also used the liblwjgl.so and lwjgl.jar in my eclipse project…Im going to try and set up a new project that is linked to the cvs. I can get it to work on my machine, but only if I use the prebuilt jars on the website…(jME 0.6)

Can someone get him a jar? I’m on the dial up and it will take awhile to send.

I didn’t alter Matrix4f at all. The Milkshape loader was doing wierd things even before I put mine up. I just figured someone was updating it or something, so I stayed quiet.





Again, the new .ms3d milkshape loader doesn’t alter -or- use anything that the .txt loader did.

Sorry, cep21, I was absolutely wrong. Renanse it appears the problem is with the new FastMath stuff in Matrix4f.

I still cant figure this out. Basicly, I got it to work with jME v 0.6. But with 0.6 I cant use the new Milkshape loader. If I upgrade with the cvs version, the app crashes with no error. Since youve gotten it to work, It must be something wrong with my system, like the .so files (im on linux too :slight_smile: ) What it does is run for about 20 seconds, it calls update and render about 100 times, then crashes. Anyone have any ideas?

This is truly bizarre. I would guess that it’s a memory leak. But I was able to run your same application for about 4-5 minutes, before I killed it. Have you tried it in different ways? In Eclipse, in command line, etc?

I just ran it in a terminal, and after the 30 seconds, it said: Aborted. What version of LWJGL is included in the cvs?

We are using LWJGL 0.9.



Just Aborted? No more information than that?

nope, thats all. It doesnt even reach the cleanup call.

I havent figured it out yet, but I got the terrain to show again by copying TestTerrain. Now I just have to figure out what Im not doing to make it crash like it does. Ill post again tommorow if I figure out what the problem was.

Run through all the tests and make sure they all work. If they all work then it must be something with VariableTimestepGame. If one of them fails, that might give us more information.