Hey Gernot,
I've been playing with GLB for a bit now and I was just wondering how hard it would be to create a set of commands that create 3D objects?
What I mean is, rather than the user developing their own functions for creating spheres, cubes, torus' etc., they could simply type in...
Instead of...
And then calling...
It's just something that seems a little more user-friendly for beginners, especially those who don't understand geometry all that well (like me!).
The best part could be that the user could still manually create the objects via code instead of the compiler auto-generating it through one command, allowing for more advanced users more options.
What do other, more seasoned users of GLBasic think?
I've been playing with GLB for a bit now and I was just wondering how hard it would be to create a set of commands that create 3D objects?
What I mean is, rather than the user developing their own functions for creating spheres, cubes, torus' etc., they could simply type in...
Code (glbasic) Select
//Create a sphere
CreateSphere(objNum, objSize)
Instead of...
Code (glbasic) Select
FUNCTION CreateSphere: num, r, n, col
LOCAL i,j, theta1, theta2, theta3, pi
pi = ACOS(0)*2
IF r < 0 THEN r = -r
IF n < 4 THEN n = 4
X_AUTONORMALS 2 // smooth edges
X_OBJSTART num
FOR j=0 TO INTEGER(n/2) -1
theta1 = j * 2*pi / n - pi/2;
theta2 = (j + 1) * 2*pi / n - pi/2;
FOR i=0 TO n
theta3 = i * 2*pi / n;
X_OBJADDVERTEX r*COS(theta2) * COS(theta3), r*SIN(theta2), _
r*COS(theta2) * SIN(theta3), i/n, 2*(j+1)/n, col
X_OBJADDVERTEX r*COS(theta1) * COS(theta3), r*SIN(theta1), _
r*COS(theta1) * SIN(theta3), i/n, 2*j/n, col
NEXT
X_OBJNEWGROUP
NEXT
X_OBJEND
ENDFUNCTION // n
And then calling...
Code (glbasic) Select
CreateSphere(sphere, 18, 12, RGB(255,255,255))
It's just something that seems a little more user-friendly for beginners, especially those who don't understand geometry all that well (like me!).
The best part could be that the user could still manually create the objects via code instead of the compiler auto-generating it through one command, allowing for more advanced users more options.
What do other, more seasoned users of GLBasic think?