Few quick questions about vertex attributes, also tokamak

Blitz3D Forums/Blitz3D Programming/Few quick questions about vertex attributes, also tokamak

mrtricks(Posted 2004) [#1]
1. If I use VertexColor() on a vertex to set its RGB, then use VertexRed() to extract the info -- is it screwed up in 16-bit mode? Or can I expect to get the exact same figure back? (I want to use it to store information to extract later, rather than set a colour.)

2. Can vertex normals be set to any floating point number, or do they cap at 1 (or -1)? Does the system scale them back to cap the highest at 1, since the NXYZ attributes form a vector? (The same reason, I want to use them to store information for later retrieval.)

And in Tokamak:

3. Does it get too much with complex items with lots of vertices? Can you only use convex meshes?

4. Can you assign only SOME of the vertices in a mesh as tokamak vertices (ie, once you specify a mesh as a tokamak object, do ALL verts react to collision whether you want them to or not?)


Sweenie(Posted 2004) [#2]
3)
The static mesh can be as complex as you want, but remember that only one static mesh is allowed.
The dynamic(non-static) bodies can only be built from primitives, that is spheres, boxes and capsules.
However there is no limitation on how to use them so concave shapes is allowed.

4)
You feed tokamak with the triangles you want it to do collision-checks with so if you only want collision with a couple of triangles,just send those to tokamak.
And again, this only works with the static(non movable) mesh.


Beaker(Posted 2004) [#3]
If you have more Tokamak questions there is an official Blitz-Tokamak forum here:
http://playerfactory.proboards25.com/


mrtricks(Posted 2004) [#4]
Thanks...

re 4 though: What about when the tokamak objects collide with each other? or is it that they collide with each other, plus one static mesh?

And how is a static mesh defined? Is it just a mesh that you don't move, or is it a special kind of mesh that must be loaded in a certain way? (ie cannot be a custom mesh built within the program)

It's sounding like maybe I can't use tokamak... I'm making a FPS/RTS hybrid where buildings can be built and positioned and destroyed on the fly -- therefore maybe the tokamak objects (vehicles etc) couldn't be made to collide with the dynamic building structures... ? (The buildings don't MOVE, they just appear and disappear (bit by bit)


Mustang(Posted 2004) [#5]
Tokamak "tutorial":

http://www.blitzcoder.com/cgi-bin/articles/show_article2.pl?f=bot__builder102082004102230.html


mrtricks(Posted 2004) [#6]
Cool - will look at that asap.

With ref to 1) and 2): Can uv values (both sets) be set to anything, even 60000 or something? Same reason, in order to store information for later retrieval.


big10p(Posted 2004) [#7]
Normals can hold any values - pretty sure the same goes for UV etc. Try it out, it'll only take a minute.

I must admit I'm a bit confused: If you're planning to use normals, UV's etc. to store 'other' info then how are you going to light, texture or otherwise display your meshes correctly?


Bot Builder(Posted 2004) [#8]
Uvs can be anything. that's how they work out repeting textures over a single poly.


mrtricks(Posted 2004) [#9]
@ big10p: I'm not displaying these verts at all - I am just attempting a new explosion system -- have tried using types for it but they get too complex. Bit complicated to explain and I don't even know if it'll work or have any benefit yet! I like the idea of creative uses for one thing as another thing -- in this case using a mesh with verts but no tri's as information storage. Basically, it means I can check two pieces of information at the same time, hopefully saving a few millisecs.


Rob(Posted 2004) [#10]
The lookup is still slow from verts. You will be faster using arrays.


mrtricks(Posted 2004) [#11]
Hmmm. Maybe that will be a factor. It's more to do with the method than the raw speed of the info storage, but I won't know until I do it. :)


Murphy(Posted 2004) [#12]
nad one thing:

for the static mesh in tokamak (normally the level) you can use this great function

Function MakeTokCollider(mesh)
scount=CountSurfaces(mesh)
For ind=1 To scount
surface=GetSurface(mesh,ind)
ttltris=ttltris+CountTriangles(surface)
ttlvert=ttlvert+CountVertices(surface)
Next
vertices=CreateBank(16*ttlvert)
triangles=CreateBank(24*ttltris)
offsetv=0
offsett=0
For ind=1 To scount
surface = GetSurface(mesh,ind)
ctr=CountTriangles(surface)
tric=tric+cvt
cvt=CountVertices(surface)
;fill bank with vertices
For v=0 To cvt-1
PokeFloat vertices,offsetv,VertexX#(surface,v)
PokeFloat vertices,offsetv+4,VertexY#(surface,v)
PokeFloat vertices,offsetv+8,VertexZ#(surface,v)
PokeFloat vertices,offsetv+12,0.0
offsetv=offsetv+16
Next
;fill bank with triangles
For v=0 To ctr-1
PokeInt triangles,offsett,tric+TriangleVertex(surface,v,0)
PokeInt triangles,offsett+4,tric+TriangleVertex(surface,v,1)
PokeInt triangles,offsett+8,tric+TriangleVertex(surface,v,2)
PokeInt triangles,offsett+12,2 ; Material ID
PokeInt triangles,offsett+16,0
PokeInt triangles,offsett+20,0
offsett=offsett+24
Next
Next

;Hand over the terrain data to Tokamak
TOKSIM_SetStaticMesh vertices,ttlvert,triangles,ttltris
; Now we can free the banks as Tokamak has copied all data
FreeBank vertices
FreeBank triangles
End Function


see here http://playerfactory.proboards25.com/index.cgi?board=tokamak&action=display&num=1077979419


mrtricks(Posted 2004) [#13]
So can you set and reset a static mesh collider? As in, the buildings I was talking about, every time a chunk is knocked out of one, just delete the old collider and set a new one?

PS. The vertex-holding-information -- got it to work but was rubbish! Back to the old method to try and tighten up...