3ds loaders!

Started by darkprophet, December 02, 2003, 16:10:37

Previous topic - Next topic

darkprophet

hi all,
ive read the obj loader, downloaded the jar file thing, and got it running, i get all this code which I dont know how to use to get the model in my programs, does anyone know?

also, ive tried doing the volumetric fog nehe tutorial and some methods from there appear to be missing, e.g:

GL.glMaterialfv(..etc)

what does the v stand for, and do I need it?

WiESi

Quote from: "darkprophet"what does the v stand for, and do I need it?

here some of the function endings in opengl:
"v" ... array
"f" ... float
"d" ... double
"i" ... int

wiesi

princec

But we've gotten rid of the suffixes now in favour of strongly typed method overloading from Java instead.

Btw, everyone keeps on writing complex and fiddly loaders for the nasty 3ds and ultra-nasty ASE file formats, when really what one should be doing is writing nice simple XML exporters in MaxScript. Which is what we did :) When Chaz resurfaces from internet-less hell I'll get him to dig it up.

Cas :)

darkprophet

thx princec, has chaz arose from the dead yet?

can I ask you lovely bunch of people another question? collision detection? how in the world do you collision detect?

princec

No, the bugger's still completely cut off from the internet :(

I do collision detection in 2D so it's probably not what you want to hear ;) However, the way I do it is similar to a very cheap and cheerful way of doing it in 3D. Basically I use circle-circle collision in 2D; in 3D you could use sphere-sphere collision - it's very, very trivial to calculate. You need to save sphere collision data alongside your models as most models don't fit nicely into a single sphere.

Cas :)

darkprophet

thats exactly what I want..2D collisions...wow, your a mind reader!!  :)

princec

Here's the code, straight from Alien Flux:
/**
	 * Calculates all the entities which clip a certain circle. Entities which
	 * cannot collide are ignored.
	 * @param x The X coordinate of the circle
	 * @param y The Y coordinate of the circle
	 * @param r The radius of the circle
	 * @param dest An arraylist to stash the results in. It is cleared on entry.
	 */
	public static void calculateProximity(int x, int y, int r, ArrayList dest) {
		dest.clear();
		
		final int n = entities.size();
		for (int i = 0; i < n; i ++) {
			EntityInstance ent = (EntityInstance) entities.get(i);
			if (ent.canCollide()) {
				tempVector.set(ent.position);
				tempVector.translate(-x, -y, 0);
				int dist = (tempVector.length() - r) - ent.getRadius();
				
				if (dist <= 0)
					dest.add(ent);
			}				
		}
	}

It could probably be optimized a wee bit but I was fiddling around at the time and had better things to think about. But that's the gist of it.

Cas :)

darkprophet

elllo ello ello... :shock: what da?
can you please explain the code please?