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

Messages - IJs

#1
Support / Re-use multi texturing
July 29, 2005, 03:07:47 PM
int addTriangle(SimpleVector vert1, float u, float v, SimpleVector vert2, float u2, float v2, SimpleVector vert3, float u3, float v3, int textureID)
         Adds a triangle to the object.


That's exactly what I needed.

Thanks very much!

btw jPCT is an excellent piece of work.
#2
Support / Re-use multi texturing
July 29, 2005, 12:46:40 PM
I'm trying to create a dynamic loader for maps in Java using jPCT.
It reads a specific file format, that contains some sort of grid (including x,y,height and texture type) that can be used to generate the map.

The map itself is based on planes (for the ground) and blocks (for everything above ground level) with a pre-defined width and length. So every plane/block is equal in size, except from the height.

The problem here is the (multi) texturing.
Right now I'm having the map generator create a new Object3D whenever a new texture is used. The result is the following:

(Don't mind the gaps in the middle, they're just for testing)

As you can see, there are two kinds of textures. That means in this case two Object3D's have been generated, for each set of planes with the same texture.
I'm doing that because it's not possible to load multiple textures into one Object3D, when it's not created by the 3ds-loader.

Here's the real problem.
This solution is OK for planes. But once I start creating blocks, that should be able to have 5 different textures assigned to them (each side + top of it) it might get a little bit out of hand since I'll have to create 5 different Object3D's for 1 block.
I think I'll have pretty much blocks on the map, so creating 5 Object3D's for each block seems a waste of memory.

Or does jPCT have some sort of hidden multi-texturing function?

Now I thought of using 3DS files to use the multi-texturing feature of the 3ds-loader.
But let's say I'm using 1 3DS file with the block mesh in it, and pre-defined texture names (such as 'side', 'top', 'left', etc.).
I'll have to load the 3DS file whenever I want to create a new block. And since the 3DS file has pre-defined texture names ('side', 'top'), this means all blocks will get the same texture. Right?
Or maybe I'm able to assign different files to the same texture? Like this (simplified!):
//generation of block 1
obj3d.Load3DS("block.3ds");
texmanager.AddTexture("side","texture1.jpg");
// generation of block 2
obj3d.Load3DS("block.3ds");
texmanager.AddTexture("side","texture2.jpg");

But this probably means both blocks will have texture2.jpg as side-texture.

Any ideas?