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

Pages: [1] 2 3 4
1
Support / Re: Would a WebGL port be possible via GWT?
« on: April 15, 2013, 09:39:21 pm »
Thats a shame.
I could probably work around any loading issues, but I have little knowledge of threading in regard to Jpct. Is multi-threading is needed?I am not even sure if GWT supports webworkers. :-/

Quote
The most problems will be caused by jPCT-AE's support for OpenGL ES1.x. There's no match for this in WebGL, so it had to be stripped.

How badly will stripping it mess up the rest of the code?

I guess the end goal of this is to have jPCT usable to the state which you can load and manipulate objects without having to write hundreds of lines just to display a white triangle ;)

2
Support / Would a WebGL port be possible via GWT?
« on: April 15, 2013, 06:56:07 pm »
At the moment this is speculation, but I'd like feedback on how hard this would be as (with permission) its something I might like to try a few months from now.

I am a really big fan of Jpct, its made my Android project a lot easier.
I do a lot of web work as well, and it would be nice if I could leverage my knowledge of Jpct to make 3d web apps and games easily.

*WebGL is based on Open GL ES.

*GWT is a rather nice framework for writing Java and having it cross-compiled to Javascript.  It works well enough that you can normally reuse Java libs you might have, provided they are not intended for any visual or loading stuff. (I have, for example, shared a lot of semantic logic code between a Android app and a Web game)
https://developers.google.com/web-toolkit/

* Theres already libs for GWT that allow you to use WebGL in Java:
http://code.google.com/p/gwtgl/wiki/BindingTutorial
(essentially a 1:1 mapping of the Javascript functions)



So my thinking is that it should be possible to make a version of Jcpt which you can import into a GWT project. Essentially mapping the Open GL ES functions to their equivalent WebGL  Javascript functions.

Is this a mad dream?
Is it a insane amount of work?

Thoughts?

3
Support / Re: Version updates!
« on: July 02, 2012, 10:49:18 am »
Just a quick thanks for the updates!
Some really cool stuff here.

Seems to have fixed a transparency issue I was having :)

4
Not sure if anyone is interested but we have a earlier alpha of our Skywriter app concept:

http://code.google.com/p/skywriter/downloads/detail?name=skywriter5.apk&can=2&q=#makechanges

Its not too usefull but you can:

- Login with any XMPP/Jabber based account (like Google)
- Create a wave (which is a multi-user chatroom)
- Invite users.
- Post a billboard sprite with writing on at any location you see. (click and hold on the AR view and go "create" to make a billboard, then use +/- volume to adjust distance. Hold over the newly created item again and go "confirm" to add text and post)
- Any one in the room you posted it too can see it.
- You can create as many rooms as you like, different people in each, post to any of them, toggle visibility of each.

What you cant do:

- No persistence. As we are using XMPP, the app its currently limited to just seeing stuff posted if you are currently logged in. You log-out and its lost. Sorry :(   Think of it like IRC chat :P

Long term goal:

- To have this as a fully-featured open protocol, allowing anyone to make a browser for it.
- To have connections to WFP servers, allowing persistency.
- Support more elaborate AR models being created on the fly.  (you can actually already display full 3d models with textures by sending a ARWave link, but they need to be posted from a PC client, if anyone wants to try this out I will spec out the link format - its pretty simple).

5
Support / Re: Client/Server Networking in JPCT-AE
« on: May 02, 2012, 01:49:37 pm »
I have successfully got 3ds (created by 3dsmax) objects loaded from a sever, with textures, provided the textures are in a known location on the server so yes, it does work. Or, at least, can work :)

The following is code taken straight from my app. Its VERY messy, and uses a few things specific too my app.
However, it should give you some keywords too look for.

Code: [Select]
//its a 3ds file , so a mesh
object3dtype = ARBlipObject.ObjectType.MESH_OBJECT;

HashSet<String> Namesbefore = TextureManager.getInstance()
.getNames();
int SizeBefore = Namesbefore.size();

// load 3d model
URL downloadfrom = new URL(newblip.ObjectData);
URLConnection conn = downloadfrom.openConnection();
conn.connect();
BufferedInputStream bis = new BufferedInputStream(conn
.getInputStream());
Log.i("3ds", "got stream");
Object3D[] newobjects = Loader.load3DS(bis, 1);

for (int x = 0; x < newobjects.length; x++) {
newobjects[x].rotateX((float) Math.PI / 2);
newobjects[x].rotateZ((float) Math.PI);
newobjects[x].rotateY(-((float) Math.PI / 2));

newobjects[x].rotateMesh();
newobjects[x].setRotationMatrix(new Matrix());
}

Log.i("3ds", "now merging...");
newmarker = Object3D.mergeAll(newobjects);

// This scale is wrong...no idea what the correct scale to use
// is :(
// newmarker.scale(2f);

// clear memory first
System.gc(); // no idea if this is a good place, but I was
// getting some out of memory errors without it

// ok, if occlusion is set, then we simply dont specify a
// texture
if (newblip.isOcculisionMask) {

newmarker.setTexture("occlusion");

return newmarker;
}

HashSet<String> newNames = TextureManager.getInstance()
.getNames();

newNames.removeAll(Namesbefore);

// now get the texture names
Iterator<String> it = newNames.iterator();

// get path
String URLPath = newblip.ObjectData.substring(0,
newblip.ObjectData.lastIndexOf('/') + 1);

try {
ARWaveView.fetchAndSwapTexturesFromURL(it, URLPath);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

Log.i("3ds", "created 3ds");

Code: [Select]
static void fetchAndSwapTexturesFromURL(Iterator<String> it, String URLPath)
throws MalformedURLException, IOException {
while (it.hasNext()) {

String textureNameToLoad = (String) it.next();
Log.i("3ds", "Loading Texture:-" + textureNameToLoad);

// get the url
// NOTE; filename must be lower case
// In future we might want to check for uppercase too.
// Unfortunately, 3dsmax stores all its filenames uppercase
// internally, so we cant have mixed cases
// in filenames, as they wont be recognised.
String TextureURL = URLPath + textureNameToLoad.toLowerCase();

Log.i("3d", "getting texture at " + TextureURL);

// make the texture
URL texturedownloadfrom = new URL(TextureURL);
URLConnection textureconnection = texturedownloadfrom
.openConnection();

textureconnection.connect();
BufferedInputStream texturebis = new BufferedInputStream(
textureconnection.getInputStream());

Bitmap maxtexture1 = BitmapFactory.decodeStream(texturebis);
TextureManager tm = TextureManager.getInstance();
Texture newmaxtexture = new Texture(maxtexture1);

// swap it in
// Note; This automatically assigns the correct textures onto the
// model, because when the model was loaded, it was assigned the file names in the
// 3ds file for its texture names.
// neat eh?
tm.replaceTexture(textureNameToLoad, newmaxtexture);

}
}


Now, the tricker thing is sending a mesh from the client app to the server....

6
Support / Re: clearObject and rebuild? (trying to recreate a object)
« on: April 28, 2012, 05:37:05 pm »
Ok, trying to get the hang of how to use them.

I create a plane at size 1/1, then apply a scale mod in order to resize it to any value.
This seems to work....once. But if I try to resize it again, it doesn't work.
The vertex values appearing in the log seem very high - I think its multiplying it all based on what they were last time rather then starting afresh....however, I am using IVertexController.PRESERVE_SOURCE_MESH.

Heres my code:

Code: [Select]
public class Rectangle extends Object3D {

int quads = 0;
  Object3D obj;
  Mesh planeMesh;
 
public Rectangle (int quads, float scalex, float scaley) {

super(quads*quads*2+8);
this.quads = quads;
  obj=this;
 
      createRect(quads, 1,1);
                 
obj.build();

planeMesh = obj.getMesh();

      this.setSize(1, 1);
     
   }



private void createRect(int quads, float scalex, float scaley) {

Log.i("text", "building for size: = "+scalex+","+scaley);

float startx=-scalex*(float) quads/2f;
      float starty=startx;
      float tx=0f;
      float ty=0f;
      float dtex=(1f/(float) quads);
   
     
      for (int i=0; i<quads; i++) {
         for (int p=0; p<quads; p++) {
            float dtx=tx+dtex;
            float dty=ty+dtex;
            if (dtx>1f) {
               dtx=1f;
            }
            if (dty>1f) {
               dty=1f;
            }
            obj.addTriangle(new SimpleVector(startx, starty, 0), tx, ty, new SimpleVector(startx, starty+scaley, 0), tx, dty, new SimpleVector(startx+scalex, starty, 0),
                            dtx, ty);
            obj.addTriangle(new SimpleVector(startx, starty+scaley, 0), tx, dty, new SimpleVector(startx+scalex, starty+scaley, 0), dtx, dty, new SimpleVector(startx+scalex,
                            starty, 0), dtx, ty);
            startx+=scalex;
            tx+=dtex;
         }
         starty+=scaley;
         startx=-scalex*quads/2;
         tx=0;
         ty+=dtex;
      }
}


/** uses a vertex controller to rescale  **/

public void setSize(float scalex, float scaley)
{

IVertexController demoControl=new ResizerMod(scalex,scaley,1);


Log.i("text", "resizing to size: = "+scalex+","+scaley);



planeMesh.setVertexController(demoControl, IVertexController.PRESERVE_SOURCE_MESH);
planeMesh.applyVertexController();
planeMesh.removeVertexController();

}

private static class ResizerMod extends GenericVertexController {
private static final long serialVersionUID = 1L;

float XFactor =1;
float YFactor =1;
float ZFactor =1;

public ResizerMod(float xFactor, float yFactor, float zFactor) {
super();
this.XFactor = xFactor;
this.YFactor = yFactor;
this.ZFactor = zFactor;

  Log.i("vertex", "XFactor="+XFactor+" YFactor="+YFactor);
}




public void apply() {
SimpleVector[] s = getSourceMesh();
SimpleVector[] d = getDestinationMesh();
Log.i("vertex", "XFactor="+XFactor+" YFactor="+YFactor);
for (int i = 0; i < s.length; i++) {

//d[i].z = s[i].z - (10f * ((float) Math.sin(s[i].x / 50f) + (float) Math.cos(s[i].y / 50f)));

         Log.i("vertex", "old vertex="+i+" x="+ d[i].x);
         Log.i("vertex", "old vertex="+i+" y="+ d[i].y);
         Log.i("vertex", "old vertex="+i+" z="+ d[i].z);

d[i].x = s[i].x*XFactor;
d[i].y = s[i].y*YFactor;
d[i].z = s[i].z*ZFactor;

         Log.i("vertex", "vertex="+i+" x="+ d[i].x);
         Log.i("vertex", "vertex="+i+" y="+ d[i].y);
         Log.i("vertex", "vertex="+i+" z="+ d[i].z);
}
}
}
}



7
Support / Re: clearObject and rebuild? (trying to recreate a object)
« on: April 26, 2012, 04:22:51 pm »
a) Whoops, sorry if I posted in the wrong place - thought I posted to support anyway...

b) Really? Hmz.  I guess recreating the object isnt hard in this case - its basically a billboard with text written on it. I needed the size of the board to adjust to fit the text neatly.
The take updates occasionally (via a XMPP connection) so it shouldn't be too quick.

However, just out of interest, what would be the correct way for a more dynamically updated size?
Say, if I wanted to let the user drag to resize something - surely deleting and recreating each frame would be quite wastefull in that case.
Would in that case a  IVertexController  be better? (I have yet to learn direct vertex manipulation so I havnt delved very deep into this stuff yet)

8
Support / clearObject and rebuild? (trying to recreate a object)
« on: April 24, 2012, 10:12:05 pm »
I have a rectangle created with the following code:

Code: [Select]
public Rectangle (int quads, float scalex, float scaley) {

super(quads*quads*2+8);
this.quads = quads;

      createRect(quads, scalex, scaley);
   }



private void createRect(int quads, float scalex, float scaley) {

Log.i("text", "building for size: = "+scalex+","+scaley);


float startx=-scalex*(float) quads/2f;
      float starty=startx;
      float tx=0f;
      float ty=0f;
      float dtex=(1f/(float) quads);
      Object3D obj=this;
   
     
      for (int i=0; i<quads; i++) {
         for (int p=0; p<quads; p++) {
            float dtx=tx+dtex;
            float dty=ty+dtex;
            if (dtx>1f) {
               dtx=1f;
            }
            if (dty>1f) {
               dty=1f;
            }
            obj.addTriangle(new SimpleVector(startx, starty, 0), tx, ty, new SimpleVector(startx, starty+scaley, 0), tx, dty, new SimpleVector(startx+scalex, starty, 0),
                            dtx, ty);
            obj.addTriangle(new SimpleVector(startx, starty+scaley, 0), tx, dty, new SimpleVector(startx+scalex, starty+scaley, 0), dtx, dty, new SimpleVector(startx+scalex,
                            starty, 0), dtx, ty);
            startx+=scalex;
            tx+=dtex;
         }
         starty+=scaley;
         startx=-scalex*quads/2;
         tx=0;
         ty+=dtex;
      }
}


I wanted to be able to resize this rectangle in x/y at will, keeping its position/rotation the same, I thought I could do this with a simple clear and recreate like so:

Code: [Select]

/** rebuilds whole objec to rescale - pretty wastefull I think **/
public void setSize(float scalex, float scaley)

{ Log.i("text", "rebuilding for size: = "+scalex+","+scaley);

this.clearObject();
createRect(quads, scalex, scaley);
super.build();

}


But all that happens when I try to, say, increase its Y scale is the texture vanishes and the object stays its original size.
Any idea whats going on or how to diagnose further? :-/


9
Support / Re: Seralised formats....universaly good for mobile engines?
« on: February 22, 2011, 02:27:27 pm »
Thanks for your feedback, I passed it on during the presentations.
The president of mobile for NVidia, acting on behalf of the Kronos group, said basicly the same thing as well, - essentialy xml based formats (including their own Collada format) are good for storage/creation but not for delivery.

However, it seems that X3D format might well fit the bill despite that. It seems a rather flexible 3d format with a lot of support, but also a binary variation as well (which isn't used much yet, but for the mobile market that might just be perfect).

http://en.wikipedia.org/wiki/X3D
 
Discusions are still going, but it seems this might be the top contender at the moment.
If you get a chance to check it out, be sure to let me know as there is still very little feedback from actual 3d mobile coders on this issue.

10
Support / Re: drawWireframe
« on: February 09, 2011, 09:05:27 pm »
Ok, not a problem.
Its kinda a bit in the catagory of "lens flares" for me, nice to have as an option but not strictly essential.

11
Support / Seralised formats....universaly good for mobile engines?
« on: February 09, 2011, 02:49:56 pm »
Next week I'm going to a AR standards meeting;
http://www.perey.com/ARStandardsMeetingFeb2011.html

We are discusing with a few companies possible standards for Augmented Reality applications; both world/data link methods as well as formats used once that link is made.
Naturaly 3D formats for AR use is one of the most important things being discused, so I'm just seeking out feedback on (from a engine standpoint) what makes a good format.
With jpct I know seralisation speeds up loading....is this a "generic" good thing for formats on low end devices, or just specificly good for this engine?
Also, many are talking about markup based languages like expansions to VRML, ARML, KARML etc, as well as KML type stuff. Are these formats relatively "heavy" or not much of a problem given todays hardware?

This isn't specific requests about what jpct should support in the future, more just hypothicaly the sort of recomendations that would be usefull to make.

12
Support / Re: drawWireframe
« on: February 09, 2011, 02:45:08 pm »
There are times when I'd have found wireframe usefull - mostly in editing/debugging a scene and wanting to see bits more clearly.

Is it a lot of work to implement in the engine? Or just something you have to copy over or toggle on?

Might be a little retro-thinking of me, but sometimes wireframes can be used nicely in games too. (I've seen it used to add "thin detail" onto objects back when polygon counts were still very restrictive).
But that would be need to be on a per-object base's and not sure how possible that is.

13
Support / Re: Method to make objects stay the same size with distance?
« on: February 03, 2011, 09:33:14 pm »
Thanks, I'll go with that one.
Is it really just linear? Wouldn't it depend on lens/fov?

I'm basicly going to measure the distance between the objects and the camera and set their scale equal to there existing scale times that value.  That seems...wrong..though. Too easy :p

14
Support / Method to make objects stay the same size with distance?
« on: February 02, 2011, 02:10:50 pm »
I'm working on a little AR app, and it would be helpfull if there was a way to make billboard sprites not scale with distance.
That is, if they are far away they are the same size as near.

I figured theres two ways of doing this, and I wondered if anyone could give feedback on what seems the best and what sort of maths would be required;

1. Each time the camera moves scale all the billboard sprites to compansate.  This would mean mesuring their distance to then camera [insert formular] and scaleing based on that.

2. Drawing the sprites directly to the screen not using the 3D scene at all - obviously this takes care of the scaleing easily, but raise's issues such as drawing order and positioning.

I'm guessing number 1 will be more flexible, and 2 would be more efficiant in terms of cpu.
Number 1 would also let me scale by other methods too if I wished - like getting slightly smaller with distance rather then realisticly exponetialy smaller.
The camera in my app shouldn't be moving too much - walking pace in a city with gps updates probably means only once every few seconds at most.

So..and ideas on the direction I should take?



15
Feedback / Re: Search in wiki unclickable in Chrome?
« on: December 12, 2010, 03:54:57 pm »
Yup, works fine now, cheers :)

Pages: [1] 2 3 4