creating custom 3d primative

Blitz3D Forums/Blitz3D Programming/creating custom 3d primative

Duckstab[o](Posted 2005) [#1]
Ive been working over a few concepts of creating 3d levels on the fly

Im storing the data in arrays Map(10,10) and then using this data to draw quads at marked positions and checking if its a corner,wall,end and what the faceing or the quads should be

the problem is in the array what i want is the wall to only contain 6 quads

data 0,0,0,0,0,0,0,0,0,0
data 0,1,1,1,1,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
ect


I could use a scale cube 4,1,1 and add it to the mesh

but the will cause the tris to overlap in the below array

data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,1,0,0,0,0,0,0
data 0,0,0,1,0,0,0,0,0,0
data 0,0,0,1,0,0,0,0,0,0
data 0,0,0,1,1,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0
ect


basically this will look like a tetris peace with 18 polys

any ideas how I could improve this


Rook Zimbabwe(Posted 2005) [#2]
Um... stupid thing but I have scaled entitys at decimal values as well... eg: Scale Cube,4,.5,.5

What kind of spacing are you using when you read the arrays to put the cubes? In one of my games I created an array to hold X and Y values so I would simply be able to check this against data to read a level... The values used there were only for a 12 X 12 board but they had values from -60 to 60 with a step of (I think) 15...

Does that make sense?


Beaker(Posted 2005) [#3]
This might help:
http://www.blitzbasic.com/codearcs/codearcs.php?code=526

You may have to write your own CreateCube() function tho.


Duckstab[o](Posted 2005) [#4]
@beaker
Thanks beaker tried that code is okay but i want to create new primatives on the fly it will delete duplicated faces but not merge quads that are side by side which is the poly killer of building levels unless using a huge culling system .

? is texture scaling a bigger frame hit than using more quads in a single face.

@Rook
I always use meshes in scales of 1*1 or 2*2 and there multipuls as these then can easly be scaled to match blitz primitives if you use them and objects are not deformed

also using meshes with scales of 10,10,10, and scale then to 1*1*1 or 2*2*2
for acurracy and easy creation


Matty(Posted 2005) [#5]
Duckstab[o] - in one of my games "grave robber" (and another which I stopped working on) I create the level from a text file using a quad for the floor, quads for the walls and a quad for the roof in such a way that the quads do not overlap, and I use "addmesh" since they often share the same texture map. Using addmesh like this means that I am able to use a single surface for the floor, a single surface for the walls and a single surface for the roof. However when the level gets rather large it makes sense to split it into smaller sections.

I think my source code is in the download (about 2-3Mb - includes media and executable). Feel free to play around with it / rip it out / throw it away.


Download link:

http://home.swiftdsl.com.au/~gezeder/lloyd/graverobber.zip