Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - neo187

Pages: 1 2 [3] 4 5
Support / Re: object list not being consistent during rendering
« on: January 02, 2012, 11:51:08 am »
Ok so it turns out that that's an error that you also get when you forget to .build() your deserialized objects...

I can't remember why I was doing this with my library, I think I read somewhere that building the objects in AE would impede some other process, maybe it was the animations.... so I was only calling .calcBoundingBox() and .calcNormals()...and this was working fine in another AE project..... but yeah, seems like I need to remember to always build all objects!...

Thanks for your prompt reply!

Support / Re: object list not being consistent during rendering
« on: January 02, 2012, 12:48:25 am »
Hi Egon

I am having the same issue when I try to use Loader.loadSerializedObject to load serialized objects.

So I have the Activity class with the GLSurfaceView.Renderer class inside as per Hello World example. I have this class initialize a different class called GameWorld where I want to have the World and all the Object3Ds. I have a loadLevel method that I call on initialization to load all the objects (and they are loaded fine) and when they are loaded I call a GameWorld.draw() method that calls in turn the world.renderScene and the world.draw methods.

I get the "object list not being consistent" error as soon as the drawing begins:

Code: [Select]
01-01 23:40:29.134: INFO/jPCT-AE(687): [ 1325461229141 ] - WARNING: There's a problem with the object list not being consistent during rendering. This is often caused by concurrent modification of jPCT objects on a thread different from the rendering thread!
01-01 23:40:29.164: INFO/jPCT-AE(687): [ 1325461229171 ] - ERROR: java.lang.NullPointerException
01-01 23:40:29.164: INFO/jPCT-AE(687):     at com.threed.jpct.Object3D.transformVertices(
01-01 23:40:29.164: INFO/jPCT-AE(687):     at com.threed.jpct.World.renderScene(
01-01 23:40:29.164: INFO/jPCT-AE(687):     at com.voicegame.GameWorld.drawWorld(
01-01 23:40:29.164: INFO/jPCT-AE(687):     at com.voicegame.GameController$MyRenderer.onDrawFrame(
01-01 23:40:29.164: INFO/jPCT-AE(687):     at android.opengl.GLSurfaceView$GLThread.guardedRun(
01-01 23:40:29.164: INFO/jPCT-AE(687):     at android.opengl.GLSurfaceView$
01-01 23:40:29.184: WARN/dalvikvm(687): threadid=15: thread exiting with uncaught exception (group=0x4001b188)
01-01 23:40:29.214: ERROR/AndroidRuntime(687): Uncaught handler: thread GLThread 8 exiting due to uncaught exception
01-01 23:40:29.224: ERROR/AndroidRuntime(687): java.lang.RuntimeException: [ 1325461229171 ] - ERROR: java.lang.NullPointerException
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.threed.jpct.Object3D.transformVertices(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.threed.jpct.World.renderScene(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.voicegame.GameWorld.drawWorld(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.voicegame.GameController$MyRenderer.onDrawFrame(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at android.opengl.GLSurfaceView$GLThread.guardedRun(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at android.opengl.GLSurfaceView$
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.threed.jpct.Logger.log(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.threed.jpct.Logger.log(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.threed.jpct.World.renderScene(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.voicegame.GameWorld.drawWorld(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at com.voicegame.GameController$MyRenderer.onDrawFrame(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at android.opengl.GLSurfaceView$GLThread.guardedRun(
01-01 23:40:29.224: ERROR/AndroidRuntime(687):     at android.opengl.GLSurfaceView$

I'm not stripping any meshes and the error doesn't happen is I use the 3DS loader instead of the Ser one. In another thread a user mentions to have resolved this by separating threads... If that's the solution, how would I go about this?

Thanks for your help!

Awesome job, man. May I suggest integration with Raft's bones for Ogre files? That would be great.

And a couple more suggestions: you should be able to bitwise or Check Others with Check Self. And Set Object Properties could have a button for setCulling (I was testing jBrush with a caped model, which is why I came upon this one). Thanks for the great job.

Thank you very much. I should be able to fix the collision setting and add an option for Culling in the next release soon.

Being able to preview skeletal animations with Raft's Bones would be a nifty feature, maybe be able to mix animations by assigning different sequences to different groups of bones.... but it'd be quite a bit of work, for which I don't really have the time at present, but maybe later on!

Thanks again for the feedback.

Have just uploaded v0.27with an option to set the object's culling and to bitwise Check Others and Check Self.

A new version of jBrush has just been uploaded. New features in v0.2:

-Create and place trigger volumes (with library functions to listen for trigger collisions)
-Create and edit GUI and Heads Up Display icons (with library function to modify them in-game)

Trigger and GUIs editor preview and lib usage.

-Preview and play MD2 animations in the editor (with library functions to play MD2 animations with one line of code)

The editor now lets you serialize and export both an MD2 animated model and an animation created in the editor out of 3DS keyframe meshes. The latter option is particularly good for Android, as an MD2 model uploads geometry data for every single frame of the animation, which can result in running out of memory with complex meshes. 3DS animations from jBrush only export the main keyframes (e.g. the 3-4 stances of a walk cycle), all in serialized form, and calculate the ones in between at runtime (via JPCT), resulting in a lot less memory usage.

The download link is in the original post!

Thanks for the feature! Really appreciate it  ;)

Have set maxPolys to 250000, have seen that in a few examples in the forum, that seems plenty....

And yeah, i realised there was a small bug in the mouse/camera mapping...have added a fix for it though the camera still lags a bit in changing direction if you quickly change the mouse movement direction while dragging it.... have sent you a PM with the incriminated code snippet, maybe you have a better solution for that....

Have re-uploaded the package.

Will update this thread when the new features are ready!

it looks like as if you are using the software renderer in legacy mode (which is default, but maybe shouldn't be any longer...). This means that the lighting calculations are totally different from what you get on Android/OpenGL. Just add a

Code: [Select]

after creating the FrameBuffer and you'll get one in OpenGL-look-alike-mode.

The second thing is, that your method naming in the library differs from the standard Java conventions in some parts, where methods start with a lower case letter. Personally, i find this confusing.

Thanks for the feedback. I amended the buffer bit and re-uploaded, I can actually tell the difference! Yeah the capitalised methods must be confusing, I must have had Unity in mind when I wrote them as Unity has Animation.Play and Animation.PlayOnce methods.... changing those will require modifying the video tutorials, which I will do as soon as I have time...

Other than that, great work. I will add it to the projects page if you don't mind...!?
Of course! I'd love it if you put it in the 3rd party download section, along with Devkit and those other apps.... I put a lot of extra work in making sure this could be useful to other users in the community other than just for my game.

I am currently working on expanding it with a GUI editor and in-game library for displaying and receiving events from them. I'll also try and implement a "trigger" placement facility like the one Unity has, whereby you can place wireframe boxes in the map which are invisible in game but trigger events when collided with (like opening doors or elevators). I could actually use your input on that Egon, how would you go about the wireframe rendering of meshes in the editor? I am sure I have seen it in some sample code...and what do you think would be the best way of having them as invisible trigger objects in the scene?

Thank you.

Projects / jBrush - A World and Animation Editor and a Serializer tool
« on: October 21, 2011, 01:27:47 pm »
UPDATED ON 12/02/2012 - Version 0.3

Hello all,

This is a JPCT software I have created as part of a student project. It started as an exercise on the use of JPCT and it developed into this fairly complex toolkit that I used to create most part of an Android game currently available on the Android Market. I developed it a way that it could hopefully be of use to other JPCT users in their projects. While a number of versions were released, correcting a number of bugs reported, the software may still contain bugs (for which reports are appreciated!).

jBrush is a World and Animation editor. It allows you to import 3DS, OBJ and MD2 models, do the usual scale, rotate and translate operations. It has a 3DSMax-like interface where you can navigate the camera through the environment, rotate it around an object, position it front, side or on top of the scene.

World Editor:
In jBrush you can assign textures, most of the Object3D properties (name, collision, transparency, culling, emissive color, bumpMap, parent/child). You can also set up point lights, ambient light. The tool lets you export the scene as an instruction file which can be imported with two to three lines of code inside your JPCT/AE project with the aid of the library that comes with it. The library creates Object3Ds for all the models in the scene and it lets you fetch any of the them by the name given in the editor so that they can be used for further game actions.

Animation Editor:
jBrush is also a keyframe animation viewer and editor. It allows you to playback MD2 animations and to create your own animations out of 3DS keyframe meshes for a model (e.g. the 3-4 main stances of a walk-cycle) and set name and speed to the sequence created.
When linked to your project the library will take care of all the animation routines so that for any Object3D you can start or stop an animation with just one line of code. You can play animations continuously or play them once, at the same speed set up in the editor.

Serializer Tool:
Finally jBrush works as an interface to JPCT's Serializer facility, so it lets you export any supported model in serialized format (.ser) for more efficient processing on the Android.

An example use of this tool for instance is to create a scene with the environment models, create keyframe animations for an enemy, place the enemies inside the map and export the entire scene. The library will let you import the scene and fetch all models whose name contain a given parameter (e.g. "enemy") and with one line of code you can play their "moving" animations and execute further game code on them.

  • Triggers and GUI editors. Create trigger volumes and place them in the map. Use the library functions to have the engine check for collisions between triggers and game objects in order to trigger behaviour (opening of doors, elevators, activation of enemies, starting a cutscene et cetera.)
  • Create GUIs and Heads Up Display icons from image files, edit them and position them in the in-game screen. Use the library functions to dynamically turn GUIs on or off, change their position and size in-game.

  • Playback MD2 animations in the editor.
  • Serialize, reduce and export both MD2 animated models and Animations created in jBrush out of 3DS meshes (higher memory optimization for Android with the latter).
  • Set culling and collision properties
  • Set objects' parent/child dependencies and preview parented movements in editor
  • Get position and orientation of editor camera (useful for recreating a specific view angle in game)
  • Wireframe view mode (Useful when scene gets complex and you need to see through objects)

  • Adjust visibility of objects
  • Several bug fixes
  • Methods for loading level file from URL document base (for JPCT applets)
  • Optimized loading of serialized objects and animations for AE
  • Improved documentation

Download the software:

jBrush (v0.3)

Video previews/tutorials on how to use the library:

World Editor preview and project setup

Animation Editor preview and lib usage


Triggers and GUI editor preview and lib usage

Place 3DS, OBJ and MD2 models in the scene. Edit their texture and properties.

Set up point lights and ambient light.

View MD2 animations or create animation sequences from 3DS keyframe meshes.

Place collision volumes (triggers) in the scene and create GUIs and Heads Up Display icons.

Support / Re: Mouse-drag camera rotation (UDK like)
« on: October 14, 2011, 10:18:10 pm »
Hi Egon

So I am trying to improve my camera with a function that allows for it to rotate around a selected object. This code you provided in the post you mentioned does almost exactly that but it seems to make the camera rotate uniquely around the origin of the world:

Code: [Select]
        SimpleVector line=new SimpleVector(dx, 0, dy);

        Matrix m=line.normalize().getRotationMatrix();

        m.rotateAxis(m.getXAxis(), (float) -Math.PI/2f);
        camera.moveCamera(Camera.CAMERA_MOVEIN, 50);
        camera.rotateAxis(m.invert3x3().getXAxis(), line.length() / 200f);
        camera.moveCamera(Camera.CAMERA_MOVEOUT, 50);

I tried editing this in many ways but I cant seem to get anywhere.... would you have an input for that?


Support / Re: Modify existing Animation objects?
« on: October 14, 2011, 12:19:01 pm »
Thanks for your exhaustive answers. Always very helpful. I managed to complete most of what I had in mind. I can't really find a way to enable the user to remove an existing sequence as the current Animation.remove() method removes that data but not the actual array entry so that it will keep showing up the Animation info but if accessed or checked it just gives a big crash....

Thats a bit of a let down but the editor is functional nonetheless...


I've sent you a PM!

Support / Modify existing Animation objects?
« on: October 12, 2011, 02:11:43 pm »
Hi Egon

For this visual map editor that I am making, I'd like to implement an interface for creating a keyframe animation by browsing for mesh files, ordering them into a sequence, playing the animation back in the editor, and come back later to edit it...

Currently if I have an object selected I get retrieve its attached animation if any, I can get the number of subsequences and their names, play each subsequence by name... but say I wanted the user to be able to add a new sequence at a later time, they would have to work within the number of frames assigned when the Animation object was created (Animation(int keyframeCount)) and if they accidentally assign more I think I read that an exception is thrown... currently there is no way to update this keyframe number after the object has been created?

I don't get what the getSequenceBorders(int seq) method does exactly, but would there be a way to get a list of the meshes per sequence? getKeyFrames() only returns them all....and the Mesh objects could not have a get/setName like Object3D? So as to maybe show the name of the file opened for each keyframe?

And final question, I read that for the Animations to play on AE following the guidelines on the wiki you need to replace with calcNormals(), and that's all right?

Thanks for reading this!

Support / Re: project3D2D runtime errror
« on: October 11, 2011, 01:53:22 pm »
brilliant. A check for a null values solved it... I really hand't seen that in the DOCs.... Thanks for your prompt help!

Support / project3D2D runtime errror
« on: October 11, 2011, 12:06:56 pm »
Hey Egon

I can't find a way to get round this.... So I'm using Interact2D.project3D2D to calculate the screen coordinates of a 3D object, and if those coordinates are inside the frameBuffer I blit a 2D image on it....

As I move around the world and the object falls far behind the camera, this check inevitably gives a NullPointerexception and a runTime error, right about when the coordinates get towards 20000 or 20000.... I am not blitting anything at those coordinates, the runtime error comes only from the check:
Code: [Select]
SimpleVector v = ew.getLightPos(frameBuffer);
System.out.println("" + v.x + ", " + v.y + "panel: " + this.renderPanel.getWidth());
if(v.x < this.renderPanel.getWidth() && v.y < this.renderPanel.getHeight()){
  frameBuffer.blit(bulb, 0, 0, (int) v.x, (int) v.y, 128, 128, 50, 50, 10, false, null);

The runtime error points at the third line.

Code: [Select]
public SimpleVector getLightPos(FrameBuffer fb){
SimpleVector arr = Interact2D.project3D2D(camera, fb, lights.elementAt(selectedLight).getPosition());
return arr;

Anything springs to mind?

Exception in thread "main" java.lang.reflect.InvocationTargetException
   at java.awt.EventQueue.invokeAndWait(Unknown Source)
   at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
   at Editor.loop(
   at Editor.main(
Caused by: java.lang.NullPointerException
   at Editor.render(
   at Editor$
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$ Source)
   at java.awt.EventQueue$ Source)
   at Method)
   at$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at Source)}

Support / Re: Mouse-drag camera rotation (UDK like)
« on: October 10, 2011, 11:58:49 am »
The error is (at least i think that this is the problem) that your lastMousePos is only valid as long as you are dragging. Once the dragging is over and you start a new one, they have to be set to the current mouse coordinates...not to some position from the end of the last dragging.

Ok, thanks for that! I'm making progress. So now I am recording the mouse positions whenever the cursor is moving, then when I am dragging I stop recording the cursor and calculate the difference between the latest cursor position and the new drag coordinates:

Code: [Select]
    public void mouseMoved(MouseEvent e) {
    lastMousePosX = e.getX();
    lastMousePosY = e.getY();
Code: [Select]
public void mouseDragged(MouseEvent e) {
    dragging = true;

    int newMousePosX = e.getX();
    int newMousePosY = e.getY();
    ew.rotateView((lastMousePosX - newMousePosX) /50, (newMousePosY - lastMousePosY) / 50);

    System.out.println("" + (lastMousePosX - newMousePosX) + " , " + (newMousePosY - lastMousePosY));
    dragging = false;

This does basically what I wanted it to. Only problem is that if I am dragging left and during the drag I change direction to right the camera keeps going left, which is slightly annoying... any idea what that may be?.....

but for single direction drags this works fine, so thanks for your help!

Support / Re: Mouse-drag camera rotation (UDK like)
« on: October 10, 2011, 11:13:48 am »
not sure I understand that, so currently at every drag I'm saving the mouse coordinates to newMousePos, then subtract those to the last recorded positions (lastMousePos) and then save newMousePos to lastMousePos.... where's the error there exactly?

Maybe I'll post a video but what happens with that camera code is that the camera rotates fine only when clicking and dragging on the origin (which is where my cube is and what the camera points at when starting up); but if you point anywhere else and drag it just jumps back to pointing at the origin? could it be just the mouse drag code that is causing this?

Also, with lwjgl, do you constantly record the mouse positions as you move the cursor or do you do it only when the mouse is pressed and dragged? I'm currently doing the latter....

Support / Re: Mouse-drag camera rotation (UDK like)
« on: October 09, 2011, 08:47:58 pm »
mmm, it does jerk back in my case.... maybe it's because in your example you are using lwjgl.input to calculate the delta x and y... i wrote my own listener so as to avoid attaching other libraries, this is what it does:
Code: [Select]
public void mouseDragged(MouseEvent e) {
    if(lastMousePosX == 0 || lastMousePosY == 0){
    lastMousePosX = e.getX();
    lastMousePosY = e.getY();
    int newMousePosX = e.getX();
    int newMousePosY = e.getY();
    ew.rotateView(newMousePosX - lastMousePosX, newMousePosY - lastMousePosY);
    lastMousePosX = newMousePosX;
    lastMousePosY = newMousePosY;


Maybe it's the way that the dx/dy are returned that cause the camera to always reset to point at the origin? Does lwjgl do this differently?

Thanks for your help!

Pages: 1 2 [3] 4 5