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 - VT900

Pages: [1]
1
Support / Re: Keyframe-based animation
« on: December 29, 2010, 02:32:12 pm »
I did this quickly and now get a warning:

WARNING: This OBJ-file contains n-polygons with n>4! These polygons wont be displayed correctly!

The actual model displays fine though, so I guess I left in a few polygons I shouldn't have. Any ideas on how to correct this in the obj file? I used a separate obj editor to separate the parts of the model. Is there some command line tool that will fix this? Other than that it works fine now.

2
Support / Re: Keyframe-based animation
« on: December 28, 2010, 09:04:25 pm »
How would I go about doing that? The objects are loaded in as obj models currently. How would I select the part that is meant to rotate? Do I have to export each separate part as a different object or is there a better solution?

3
Support / Re: Keyframe-based animation
« on: December 28, 2010, 05:33:40 pm »
Well, I need to swap the second object around - the user chooses which file the second object will be loaded from, so I need to keep the objects separate. So exporting the objects as one would be a disadvantage.

4
Support / Re: Keyframe-based animation
« on: December 28, 2010, 12:24:24 pm »
Yeah, I'm not too sure on how to rotate the separate parts in code though, and it would probably be best to somehow get the rotation angles from the first object and apply them in the same areas in the second object, since the second object is based on the first object but with a few sides extruded.

5
Support / Keyframe-based animation
« on: December 27, 2010, 03:39:18 pm »
Hi,

I have a blender model that I animated and exported as seperate objs for each keyframe. Basically all the animation is, is a few things rotating about pivots and I had to check an option in the blender exporter which said "Apply Modifiers" or the keyframes would not carry the rotation information.

Now, that works well, I load each keyframe in an animation object and set the animation to my Object3D, and animate it each frame using obj.animate(index, 2);, etc. That works fine.

What I have done now is create a new object that is meant to surround the first object to a degree. I have basically taken that first model, extruded some sides and deleted the parts I did not extrude. I then exported that as an obj and loaded it in, and is displays fine.

However, I now need it to "latch on" to the first object, so that it rotates simulateously with the first object each keyframe. I could animate the second object manually in blender, but I may not get the rotation angles exactly right and also it will be really tedious to do this. I was thinking of using some better solution in code.

Any ideas?

6
Support / Re: Bug in World.renderScene()?
« on: December 20, 2010, 12:48:50 pm »
I've had this problem before. this occurs when you are removing an object that has been added to the world twice. Go through your code and look for where this has happened.

I tried setting a boolean to prevent draw from being called while inside changeRoom(Room) but that did not prevent the crash. But the remove thing's out of the console:

Is World null? false Is buffer? false Number of objects: 4

Exception in thread "Thread-4" java.lang.NullPointerException
        at com.threed.jpct.Object3D.transformVertices(Unknown Source)
        at com.threed.jpct.World.renderScene(Unknown Source)
        at MyQuestForGlory.draw(MyQuestForGlory.java:1162)
        at MyQuestForGlory.run(MyQuestForGlory.java:744)
        at java.lang.Thread.run(Unknown Source)

7
Support / Re: Texture tiling
« on: December 05, 2010, 10:26:43 pm »
Haha, thanks again Egon, the bug was driving me up the wall :P
It's fixed now, at last.

Barry.

8
Support / Re: Texture tiling
« on: December 05, 2010, 10:04:55 pm »
Ok, I made some code to demonstrate this problem. I based it off the applet demo in the wiki, and hacked it together really quickly!

Test.jpg - http://img193.imageshack.us/img193/3902/testn01.jpg
The display - http://img340.imageshack.us/img340/4184/runw.png
The problem zoomed in - http://img697.imageshack.us/img697/5651/highlightm.png

Call me a bit of a perfectionist! You can see the yellow pixels showing up in at the bottom, when they are meant to be at the top only.

Code: [Select]
import java.awt.Graphics;

import javax.swing.JApplet;

import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Object3D;
import com.threed.jpct.Primitives;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;

public class Test extends JApplet implements Runnable
{
    private Object3D box;

    private FrameBuffer buffer = null;
    private World world = null;

    private boolean alive = true;
    private boolean initialized = false;

    @Override
    // Initialize all components of the applet
    public void init()
    {
        world = new World();  // create a new world
        World.setDefaultThread( Thread.currentThread() );

        // Add some light to the scene
        world.setAmbientLight(255, 255, 255);
setSize(640,480);

        // create a new buffer to draw on:
        buffer = new FrameBuffer( getWidth(), getHeight(),
                                  FrameBuffer.SAMPLINGMODE_NORMAL );

        // Create the box:
        Texture tex = new Texture("../dat/test.jpg");
        TextureManager.getInstance().addTexture("test", tex);
        box = Primitives.getPlane(2, 40f);
        box.rotateX((float)Math.PI/2);
        box.setTexture("test");
        box.build();
        world.addObject( box );

        // set the camera's position:
        world.getCamera().setPosition( 50, -250, -200 );

        // Look at the box:
        world.getCamera().lookAt( box.getTransformedCenter() );

        // Finished initializing.  Now it is safe to paint.
        initialized = true;

        // Start the main "Game Loop":
        new Thread( this ).start();
    }

    // Main Game Loop:
    @Override
    public void run()
    {
        while( alive )
        {
            // Have the box rotate:
            //box.rotateY( 0.01f );

            // Tell the applet to repaint itself:
            this.repaint();

            // Sleep for a bit:
            try
            {
                Thread.sleep( 10 );
            }
            catch( Exception e )
            {}
        }
    }

    // Draw the scene:
    @Override
    public void paint( Graphics g )
    {
        // Make sure jPCT is finished initializing:
        if( !initialized )
            return;

        buffer.clear();   // erase the previous frame

        // render the world onto the buffer:
        world.renderScene( buffer );
        world.draw( buffer );
        buffer.update();

        buffer.display( g, 0, 0 );
    }

    // End the main game loop:
    @Override
    public void destroy()
    {
     alive = false;
    }
}

9
Support / Re: Texture tiling
« on: December 05, 2010, 09:03:20 pm »
Well, I have a plane from Primitives.getPlane(2, 40f) and using the hardware renderer, though the software renderer seems to do it too. The texture is 256x256px.

10
Support / Texture tiling
« on: December 05, 2010, 08:45:52 pm »
Hi,
Apologies if this has been asked already (I couldnt find a solution by searching, maybe its just me), but theres a really annoying bug in my program. I have isolated it to one cause, and basically, the texture I have assigned the Object3D is tiling. I want it to stretch to cover the object instead of tiling to fill that space. Any way I could do this? This must sound really trivial, but I can't find anything to solve it (although, it seems like a question that would have been asked already)

Regards,
Barry

Pages: [1]