Nice geometry code

BlitzMax Forums/MiniB3D Module/Nice geometry code

JoshK(Posted 2007) [#1]
I have been looking at the matrix and transformation code in this. It's really well done. I did not realize that Blitz3D created a global matrix every time an entity changed. That is quite a bit easier to work with than storing the local matrix and rendering entities in hierarchies of pushed and popped matrices.

I have a little experimental mod running, using MiniB3d's transformation code, and the rest is code ripped from my engine. The Blitz3D entity system is its greatest strength, but I prefer my own terrain, lighting, and materials setup. I also use special BSP brush geometry for the world, instead of triangle meshes.

I think collision and raycasting should be handled exclusively by third-party libraries. Even with an mesh octree, Newton is much faster than Blitz3D, and it allows things like returning an array of triangles within a bounding box, which is how I render fast dynamic shadows.

The convenience of the Blitz3D API is what makes it a great system. It just needs a technology boost, like shaders, instanced meshes, and better lighting.

We'll see what happens...


*(Posted 2007) [#2]
I do agree with those additions Blitz3d would hold its own against everything coming at it today. Who knows what Max3d will bring but at the moment its looking like a 'Duke Nukem whenever'.

I would like to see things that are available in all other languages, the problem is this is what happened with Blitz 2.1 on the Amiga there was a rush of interest then nothing happened for ages then the PC version made an appearance.


Picklesworth(Posted 2007) [#3]
I agree with sticking to external solutions for stuff beyond general 3D graphics. For one thing, the word Mini implies small / unobtrusive. For another thing, BlitzMax works great with external libraries and modular code :)


simonh(Posted 2007) [#4]
You don't have to use the built-in functions of course but I'm glad they're there for completeness sake at least. MiniB3D is and always will be a subset of Blitz3D using nothing but Max code, and I think collisions and picking are an essential part of that.


JoshK(Posted 2007) [#5]
Fortunately this has been designed so that it is easy to just the entity type as a base. Thank you for implementing it in such a way.


Picklesworth(Posted 2007) [#6]
That's why I am happy with how MiniB3D is completely open to be changed (and also with very tidy code). If I feel that something is unnecessary, I can go in and pop it out :)


JoshK(Posted 2007) [#7]
I really recommend scaling the camera by 1,1,-1 to change the axis handedness. As it is written, you have to flip your vertex positions, and that isn't conducive to fast processing of vertex arrays.


JoshK(Posted 2007) [#8]
I really recommend scaling the camera by 1,1,-1 to change the axis handedness. As it is written, you have to flip your vertex positions, and that isn't conducive to fast processing of vertex arrays, like if you are loading or saving a file, or talking to a third-party physics lib.

Here's my code for converting a quaternion to a matrix:
		matrix[0,0]=(1.0-2.0*quaternion.x#*quaternion.x#-2.0*quaternion.z#*quaternion.z#)
		matrix[1,0]=-(2.0*quaternion.z#*quaternion.y#-2.0*quaternion.w#*quaternion.x#)
		matrix[2,0]=-(2.0*quaternion.x#*quaternion.y#+2.0*quaternion.w#*quaternion.z#)
		matrix[0,1]=-(2.0*quaternion.z#*quaternion.y#+2.0*quaternion.w#*quaternion.x#)
		matrix[1,1]=(1.0-2.0*quaternion.y#*quaternion.y#-2.0*quaternion.x#*quaternion.x#)
		matrix[2,1]=-(2.0*quaternion.w#*quaternion.y#-2.0*quaternion.x#*quaternion.z#)
		matrix[0,2]=2.0*quaternion.w#*quaternion.z#-2.0*quaternion.x#*quaternion.y#
		matrix[1,2]=2.0*quaternion.x#*quaternion.z#+2.0*quaternion.w#*quaternion.y#
		matrix[2,2]=1.0-2.0*quaternion.z#*quaternion.z#-2.0*quaternion.y#*quaternion.y#