Main Menu
Menu

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.

Show posts Menu

Topics - AGP

#121
Support / Small Request for the Docs
May 09, 2013, 06:50:54 PM
I spent an hour, about a week ago, wondering why my shadows weren't showing up. It turned out I had called setAdditionalColor on my floor to lighten its texture. If you could add a mention of how setAdditionalColor affects the ShadowHelper to the docs, I'd appreciate it.
#122
Support / Loader.loadOBJ(byte[] bytes)
September 28, 2012, 07:58:29 PM
Such method would be useful for those times when we want to protect the models. I could scramble the bytes for storing, them unscramble them for loading and passing them to Loader.
#123
Calling moveTowardsWithCollision gets my player character stuck. I can't increase the radius of the sphere but I have increased the recursion up to 4. It didn't help. Is the answer to simply increase recursion or should I do something else?


     private void moveTowardsWithCollision(Object3D toMove, Object3D towards, float amount) {
SimpleVector center = toMove.getTransformedCenter();
SimpleVector center2 = towards.getTransformedCenter();
SimpleVector direction = new SimpleVector((center2.x-center.x)*amount, (center2.y-center.y)*amount, (center2.z-center.z)*amount);
SimpleVector newDirection = collide(direction);
toMove.translate(newDirection);
     }
     private SimpleVector collide(SimpleVector directionToHead) {
collisionObject.setVisibility(true);
SimpleVector direction = hero.get(0).checkForCollisionEllipsoid(directionToHead, new SimpleVector(1f, 1f, 1f), 4);
collisionObject.setVisibility(false);
return direction;
     }
#124
Support / Transparency Revisited
September 05, 2012, 01:37:29 AM
Not having solved the shadow problem yet, I decided to move on to this one. :- ) The following image shows the result of a pressed button not set and set to TRANSPARENCY_MODE_ADD. Obviously, neither is the desired result. I've also tried making the Texture with alpha information (currently, the background is a solic black), but that didn't help either. Please help. Edit: I should mention that these buttons are being blitted onto the FrameBuffer.

#125
Support / ShadowHelper Code Never Completes
August 18, 2012, 10:03:04 AM
The following lines never complete (I put it in its own thread BECAUSE it was locking my program). The video hardware is NVidia GeForce GT 540M.


     public void run() {
Config.glDynamicBatchSize = 4000;
projector = new Projector();
projector.setFOV(1.5f);
projector.setYFOV(1.5f);
sh = new ShadowHelper(theWorld, buffer, projector, 512);
sh.setCullingMode(false);
sh.setAmbientLight(new Color(30, 30, 30));
sh.setLightMode(true);
sh.setBorder(1);
sh.addCaster(hero.get(0));
sh.addReceiver(ground);
sun = new Light(theWorld);
sun.setIntensity(250, 250, 250);
sun.setAttenuation(800);
theCamera.setFOV(1.5f);
System.out.println("\n\n\nFinished shadows.\n\n");
     }
#126
Bones / Weird Up and Down Movement
August 10, 2012, 12:06:47 AM
It seems that when I export the Cubix Studio male model (biped) with OgreMax it moves erratically up and down and the only solution that I could find is erasing the keyframes of the COM object. This way it stays still, but it looks wrong. I think that Bones is exaggerating the movements of the COM object, (say, if the COM moves up 0,5m Bones moves like 50m).
#127
Support / Android Events Question
August 02, 2012, 07:58:26 AM
I'm having trouble sending my app to the background and returning to it. My latest attempt looks like this:

In the loop (in Activity):

  public void run() {//THE GAMELOOP
    synchronized (pauseLock) {
    keepGoing = true;
    while (keepGoing) {
    if (paused) {
    try {pauseLock.wait();}
    catch (InterruptedException e) {}
    }
    ...
  }
THEN:
    protected void onPause() {
    if (musicOn)
    backMusic.pause();
    synchronized (pauseLock) {
    paused = true;
    //super.onPause();
    }
    }
    public void onResume() {
        synchronized (pauseLock) {
        pauseLock.notifyAll();
        super.onResume();
            if (keepGoing && paused) {
                paused = false;
            gameThread.resume();
            }
        }
    }


In short, this even broke the first time the program runs (it now runs properly the first time around SOMETIMES, and sometimes it doesn't). Sorry this isn't a jpct-specific question, but this is the best place I know in which to ask.
#128
Support / Problem With OBJ
July 29, 2012, 06:49:14 AM
Egon, I know you were working on improving the OBJ importer. Any luck? Could it help my current issue? The following show the same model (same OBJ file) imported on jpct and RE-imported into Max (Max gets it right):


#129
Bones / Head is Missing
June 27, 2012, 09:30:23 AM
I'm exporting a model whose head is separate from its body (but, naturally, in the same file). The following code is apparently not adding the head to the AnimatedGroup, because my model is imported headless. What gives?


     /** calculates and returns whole bounding box of skinned group */
     protected float[] calcBoundingBox() {
float[] box = null;

for (Animated3D skin : animatedGroup) {
float[] skinBB = skin.getMesh().getBoundingBox();

if (box == null) {
box = skinBB;
} else {
// x
box[0] = Math.min(box[0], skinBB[0]);
box[1] = Math.max(box[1], skinBB[1]);
// y
box[2] = Math.min(box[2], skinBB[2]);
box[3] = Math.max(box[3], skinBB[3]);
// z
box[4] = Math.min(box[4], skinBB[4]);
box[5] = Math.max(box[5], skinBB[5]);
}
}
return box;
     }
     protected AnimatedGroup createAnimatedGroup() throws Exception {
// we only specify the mesh file, skeleton file automatically loaded, and should be in same directory. 
URL ninjaUrl = new File(objectFileName).toURI().toURL();

com.jmex.model.ogrexml.OgreLoader loader = new com.jmex.model.ogrexml.OgreLoader();
OgreEntityNode node = loader.loadModel(ninjaUrl);

// data in ogre file is upside down, so rotate around x axis
AnimatedGroup animatedGroup = BonesImporter.importOgre(node, 2f, new Quaternion().rotateX((float)Math.PI));

Texture texture = new Texture(objectFileName.substring(0, objectFileName.lastIndexOf("."))+".jpg");
TextureManager.getInstance().addTexture("ninja", texture);

for (Animated3D o : animatedGroup) {
     o.setTexture("ninja");
     o.build();
     o.discardMeshData();
}
return animatedGroup;
     }
      protected SkeletonDebugger createSkeletonDebugger() throws Exception {
// in this file, root joint always remain in origin which doesn't look so good.
// so we tell debugger to ignore root joint (0)
int[] ignore = new int[animatedGroup.get(0).getSkeleton().getNumberOfJoints() - 20];
for (int i = 0; i < ignore.length; i++) {
     ignore[i] = i+20;
}
return new SkeletonDebugger(animatedGroup.get(0).getSkeletonPose(), 10f, 0.2f, 0);
      }
      protected void initialize() throws Exception {
this.animatedGroup = createAnimatedGroup();

this.skinClipSequence = animatedGroup.getSkinClipSequence();
this.poseClipSequence = animatedGroup.getPoseClipSequence();

this.hasSkinAnimation = (skinClipSequence != null) && (skinClipSequence.getSize() != 0);
this.hasPoseAnimation = (poseClipSequence != null) && (poseClipSequence.getSize() != 0);

this.skinAnim = hasSkinAnimation;
this.animationSequence = hasSkinAnimation ? -1 : 0;

animatedGroup.addToWorld(theWorld);

// all SkinnedObject3D share the same pose
this.currentPose = animatedGroup.get(0).getSkeletonPose();

this.skeletonDebugger = createSkeletonDebugger();
if (skeletonDebugger != null) {
skeletonDebugger.addToWorld(theWorld);
skeletonDebugger.setVisibility(showSkeleton);
}

        float[] bb = calcBoundingBox();
        float height = bb[3] - bb[2];
        Config.farPlane = Math.max(height * 100, Config.farPlane);

for (Animated3D o : animatedGroup) {
     o.setVisibility(showMesh);
}

        update(0); // update once to reflect changes visible in first scene
      }
#130
Support / iCade, Anyone?
June 19, 2012, 08:33:31 PM
Has anyone got any experience with the iCade (http://en.wikipedia.org/wiki/ICade) on Android? I need to make a conversion of a jpct game I wrote a while back for use with Ion's iCade. I know there are now Android drivers for it, I would just like to see the source of a simple test case (doesn't really need to use jpct) to get me started.
#131
Support / Transparency Problem (and More)
June 18, 2012, 02:37:03 AM
I made the ground texture as bright as possible to avoid this issue (no such luck). For some reason if instead of merging all the ground parts I add them as children of one of the parts (in order to test for what's the ground and not calling setTransparency(100) on it) I don't get a collision with the ground (and I am individually calling setTransparencyMode and setCollisionOptimization on the individual parts). Which brings us to this problem: all of the trees in this image are actually set behind the hills ahead and should therefore not be visible. What's odd is that the ground doesn't really appear to be transparent (seems more like a Z-buffer issue).

#132
Support / More Parent/Child Comments on the Docs
June 18, 2012, 01:59:38 AM
I wish you would include more comments on what different methods did to an object's children.

Does compileAndStrip() and compile and strip its children? Does enableLazyTransformations() optimize children? Does setCollisionMode() set the collision mode of children? Thanks in advance.
#133
I had a quick look at the PolygonManager class, but it seems to require the polygon's ID, which I don't have. So how do I get a specific polygon from the ground directly under my model? Thanks in advance.
#134
Support / Mesh Scale == Object3D Scale?
June 17, 2012, 01:47:24 AM
Assuming you haven't scaled your object and you imported it with size 1f, is the mesh's maxY-minY the model's height?
#135
Bones / Bad Animation Parsing
April 15, 2012, 06:11:04 AM
I've looked at my skeleton.xml file and other than the animations being in alphabetical order, it looks right, but when I try to play a given animation, it leaks to the next one (meaning, the parsing isn't right).
#136
Support / Normal Map Shader Lights
February 08, 2012, 03:18:36 AM
I used the wiki's normal map shader almost entirely. I placed it on a squad of Storm Troopers. And it works, except for the fact that its built-in light doesn't have an effect on the squad. If I fly near it, my ship has a light over it and, at given, but limited, angles I can see the models lit and all the detail of the normal map applied. What's also odd is that the light they have (I've kept their distinctive blue so I can tell it from my ship's light) bounces off my ship just fine if I fly near the squad. Only exact angles seem to be triggering the normal map shader (and object lighting).
#137
Support / Rotation Issue
February 01, 2012, 06:03:12 AM
Egon, I know you don't believe this, but somewhere jpct has a rotation bug (when I want to rotate an object around its center). Even Paul has said he's run into this in the past. My solution usually is to add a dummy object as follows. But in this case, even this is failing me.


Object3D dummyCenter = Object3D.createDummyObj();
dummyCenter.addChild(groundModel);
while (whatever) {
      userInput();
      draw();//DRAW THE FRAME
      follow();//POSITION THE CAMERA
      dummyCenter.rotateAxis(dummyCenter.getYAxis(), .02f);//groundModel.rotateY() DOESN'T WORK EITHER AND groundModel IS AT SimpleVector.ORIGIN (THEN TRANSLATED DOWN ON Y ONLY)
#138
Support / mergeAll() Merging Textures
February 01, 2012, 05:31:23 AM
Would it be impossibly hard to have Object3D.mergeAll() internally make one combined texture? That would be very useful to me and, no doubt, everyone else.
#139
Support / turnTo(SimpleVector)
January 30, 2012, 07:37:05 PM
I have a ship, and it follows a dummy object directly in front of it. When it reaches a certain distance from the center of the world, I would like to make it turn directly towards the player's ship. For that, I would like to calculate the degree between a direction vector composed of the ship's transformed center and its dummy's transformed center and the player's ship's transformed center. How would I go about doing that?

I've written two simple methods, a turnTo which simply calculates the number of iterations (in x degree segments) that the ship will turn on its Y axis, and a turnAround which turns the number of iterations that turnTo calculated (as follows). So how do I implement turnTo()?


      protected void turnAround() { //RUNS THE TURN-AROUND LOOP FOR THE ENEMY FIGHTER
if (!turning && i == numberOfTurnSegs) {
      turning = true;
      i = 0;
}
tieFighter.rotateAxis(enemyShip.getYAxis(), (float)Math.toRadians(10));
gameInstance.moveTowards(enemyShip, tieGuide.getTransformedCenter(), .1f); //THIS MOVES IT FORWARD
i++;

if (i == numberOfTurnSegs) {
      gameInstance.moveTowardsMinusY(enemyShip, tieGuide.getTransformedCenter(), 1f); //GET IT AWAY FROM SKY SO NO MORE COLLISION
      turning = false;
      lastTurn = System.currentTimeMillis();
}
      }
#140
Support / Unknown Windows Version (Just a Nitpick)
January 13, 2012, 06:35:18 PM
Egon, you stubborn (occasionally likeable) man, do you think it's odd jpct still calls Windows 7 an "unknown Windows version?"

Also, is it possible to undo calling an enableCanvasRenderer() call? Does it take disabling the renderer and reenabling it (I'm trying to do the hardware fullscreen-only bit on my game)?