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

Pages: [1]
1
Support / The distortion of the sphere.
« on: November 25, 2011, 09:30:44 am »
Hello! I have a problem, I create a sphere and displays it in the world. When she is at the center of the display - a round sphere (right), but when I ask her to the upper-right corner (where it generally move), it is distorted and looks like an ellipse or oval. Of course, I thought at the expense of what is due to camera angle, but I thought always that which side and the angle at which the sphere does not look - it will remain a sphere. Could you explain me or suggest how to fix it and what is the error.

Code - create sphere in the world
Code: [Select]
sph=Primitives.getSphere(15f);
sph.setAdditionalColor(new RGBColor(0, 255, 0));
sph.calcNormals();
sph.compile();
world.addObject(sph);
world.buildAllObjects();

sph.translate(0.0f,-7.85f, 0.0f);



[attachment deleted by admin]

2
Support / Re: Pls help, i have camera zoom problem
« on: November 07, 2011, 02:13:10 pm »
Solved the problem, simply put setFOVLimits (0.5f, 2.5f); and set FOV 2.5, all fit)

3
Support / [Solved] Pls help, i have camera zoom problem
« on: November 07, 2011, 01:52:05 pm »
Hello all!
I have a problem with the camera, there is a small room, but it covers the camera is not all, but rather can only see the wall. I wanted to make sure that the camera captured the majority of objects in the world, set up setYFOV, like everything turned out, but the room has turned out flattened (or stretched on the X axis), or can not seem to solve this problem with the configuration of the camera. Do not tell me how to configure XFOV or there are other methods to control the camera she seized a large area of the world?


4
Support / Re: Help pls. Resources problem
« on: October 18, 2011, 11:35:51 pm »
I know it) After reading the forums, people faced with this problem. And one solution I came. Just clean project O_o

5
Support / Re: Help pls. Resources problem
« on: October 18, 2011, 04:48:25 pm »
I solved the problem but probably incorrect, TamagochiActivity I made a static variable Resources. And AnimationEn now it works, but there was another tricky issue, why then in the TamagochiActivity now I can not get access to the resource. I'll have to actually try to use ResourceProvider

6
Support / Help pls. Resources problem
« on: October 17, 2011, 11:04:56 pm »
Hello!
The question probably stupid and has the obvious solution, but I can not solve the problem.
I have two classes -
The main TamagochiActivity
And additional AnimationEn which I set up for animation.

But when I initialize the model he can not find the resources (textures, etc.)

I can as it is not properly set up a class ...
Main class TamagochiActivity
Code: [Select]
public class TamagochiActivity extends Activity {

// Used to handle pause and resume...
private static TamagochiActivity master = null;

private GLSurfaceView mGLView;
private MyRenderer renderer = null;
private FrameBuffer fb = null;
private World world = null;
private RGBColor back = new RGBColor(50, 50, 100);
...
private AnimationEn teste=null;
...

class MyRenderer implements GLSurfaceView.Renderer {

private long time = System.currentTimeMillis();

public MyRenderer() {

}


public void onSurfaceChanged(GL10 gl, int w, int h) {



if (fb != null) {
fb.dispose();

}
fb = new FrameBuffer(gl, w, h);



if (master == null) {

world = new World();
world.setAmbientLight(20, 20, 20);

sun = new Light(world);
sun.setIntensity(250, 250, 250);




Resources res = getResources();

teste.Run();// Init myAnim animated model (Problem here)
world.addObject( teste.myAnim );// and add to world

world.buildAllObjects();
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(cube.getTransformedCenter());

SimpleVector sv = new SimpleVector();
SimpleVector sv2 = new SimpleVector();
sv.set(cube.getTransformedCenter());

sv2.set(test.getTransformedCenter());
sv2.y+=10;
sv2.x+=10;

sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
MemoryHelper.compact();

if (master == null) {
Logger.log("Saving master Activity!");
master = TamagochiActivity.this;
}
}
}
...

AnimationEn class (full)-


Code: [Select]
package com.demo.tamagochi;

import com.threed.jpct.Object3D;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.util.BitmapHelper;
import java.io.InputStream;

import android.app.Activity;
import android.content.res.Resources;



import com.threed.jpct.Animation;
import com.threed.jpct.Loader;
import com.threed.jpct.Matrix;
import com.threed.jpct.SimpleVector;


public class AnimationEn extends TamagochiActivity{
//private static AnimationEn master = null;
private float ind=0;
public Object3D myAnim=null;
//public Resources res;


public AnimationEn(){

}

public void Run(){
Resources res = getResources();//not work
//res.getR


Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(res.getDrawable(R.drawable.art)),128, 128));
TextureManager.getInstance().addTexture("texture", texture);




myAnim = loadModel( res.openRawResource(R.raw.cub1), 1.0f);

        Animation anim = new Animation(14);
        anim.setInterpolationMethod(Animation.LINEAR);
        anim.setCaching(false);
       
        anim.createSubSequence("idle");
        anim.addKeyFrame(myAnim.getMesh().cloneMesh(true));

        anim.createSubSequence("walk");
        anim.addKeyFrame(myAnim.getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub2), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub3), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub4), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub5), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub6), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub7), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub6), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub5), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub4), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub3), 1.0f).getMesh().cloneMesh(true));
        anim.addKeyFrame(loadModel(res.openRawResource(R.raw.cub2), 1.0f).getMesh().cloneMesh(true));
       
       
        myAnim.setAnimationSequence(anim);



        myAnim.setTexture("texture");

        //test.calcNormals();
        myAnim.build();

}


private Object3D loadModel(InputStream objStream, float scale) {
        Loader.setVertexOptimization(false);
        Object3D[] model = Loader.load3DS(objStream, scale);

        Object3D o3d = new Object3D(0);

        Object3D temp = null;

        for (int i = 0; i < model.length; i++) {
            temp = model[i];
            temp.setCenter(SimpleVector.ORIGIN);
            temp.rotateX((float)( -.5*Math.PI));
            temp.rotateMesh();
            temp.setRotationMatrix(new Matrix());
            o3d = Object3D.mergeObjects(o3d, temp);
            o3d.calcBoundingBox();
            o3d.calcNormals();
        }
       
        //o3d.build();
       
        return o3d;
    }
public void doAnim() {
{
ind += 0.05f;
if (ind > 1f) {
ind -= 1f;
}
}
myAnim.animate(ind,2);///,animateMe.getAnimationSequence().getSequence("standing-up"));
}


}



Please help, if its possible

7
Support / Re: Animation problem
« on: October 17, 2011, 03:35:07 pm »
Thank you very much)

8
Support / Re: Animation problem
« on: October 17, 2011, 01:03:14 am »
And if I make a few frames of animation (keyframes), then animate the transition from one frame to another will be smooth? (That is, the object will not jump?)

9
Support / Re: Animation problem
« on: October 16, 2011, 11:50:46 pm »
And what format is well suited to animation?

10
Support / Animation problem
« on: October 16, 2011, 11:10:51 pm »
Hello!
I have a problem. There is an animated object (spinning cube) in the format .3 DS, I'm trying to run the animation, but it does not move.

The place where I load the model:
Code: [Select]
Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.art)),128, 128));

TextureManager.getInstance().addTexture("texture", texture);

Resources res = getResources();

test = Object3D.mergeAll(Loader.load3DS(res.openRawResource(R.raw.animcube),1.0f));

test.setTexture("texture");

test.calcNormals();
test.build();
world.addObject(test);



The place where I animate:

Code: [Select]
public void doAnim() {
{
ind += 0.02f;
if (ind > 1f) {
ind -= 1f;
}
}
test.animate(ind);
}

The place where I run animate:

Code: [Select]
public void onDrawFrame(GL10 gl) {
doAnim();
...
(ind - float)
It's just an animated model, I can not get it to perform motion.
Help pls

Pages: [1]