### Author Topic: Feature request: Built-in commands for creating 3D primitives?  (Read 2770 times)

#### Yodaman Jer

• Mc. Print
• Posts: 47
• Codin' the Day Away!
##### Feature request: Built-in commands for creating 3D primitives?
« on: 2011-Dec-23 »
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...

Code: (glbasic) [Select]
`//Create a sphereCreateSphere(objNum, objSize)`
Code: (glbasic) [Select]
`FUNCTION CreateSphere: num, r, n, colLOCAL 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_OBJENDENDFUNCTION // 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?
Click the pic to go to my development blog!

#### Ruidesco

• Mr. Polyvector
• Posts: 236
##### Re: Feature request: Built-in commands for creating 3D primitives?
« Reply #1 on: 2011-Dec-23 »
There is a number of such functions in Samples/Common/3DPrimitives.gbas

#### Yodaman Jer

• Mc. Print
• Posts: 47
• Codin' the Day Away!
##### Re: Feature request: Built-in commands for creating 3D primitives?
« Reply #2 on: 2011-Dec-23 »
Hmm, I'll have to check that out!

Still, the user would have to include that file and then learn the parameters for each function, as opposed to just memorizing a list of commands. Wouldn't it just be easier to make a list of default 3D object commands, so that the user wouldn't have to include a functions file and learn multiple parameters?

Click the pic to go to my development blog!

#### Kitty Hello

• code monkey
• Prof. Inline
• Posts: 10851
• here on my island the sea says 'hello'
##### Re: Feature request: Built-in commands for creating 3D primitives?
« Reply #3 on: 2011-Dec-23 »
do you want that code linked with your GP2X Wiz game all the time? I don't. Why do people so dislike libraries?

#### spacefractal

• Community Developer
• Prof. Inline
• Posts: 4025
##### Re: Feature request: Built-in commands for creating 3D primitives?
« Reply #4 on: 2011-Dec-23 »
I guess a external help system could been nice. its a commandlist found.

Its could been found in the "Jumps" by a folder or by a extra tab named "library" and then do a list of functions found in same style. That could help to avoid flipping what a lib did that. My self I do often have more than one gbas used for easier to find the function required (example comon functions in own gbas file).
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

#### matchy

• Prof. Inline
• Posts: 1545
##### Re: Feature request: Built-in commands for creating 3D primitives?
« Reply #5 on: 2011-Dec-24 »
3D is not the issue. For example, DRAWCIRCLE is not a command but is a classic BASIC statement. Whatever the case a library is required and the commands are practically just functions and routines. Although, I like the idea of simplifying commands for new, young GLB users but any simpler would require a game construction kit (because there's no in-between). Perhaps something like "Extended GLBasic", like for example C64's Simon's BASIC?

#### Yodaman Jer

• Mc. Print
• Posts: 47
• Codin' the Day Away!
##### Re: Feature request: Built-in commands for creating 3D primitives?
« Reply #6 on: 2011-Dec-26 »
do you want that code linked with your GP2X Wiz game all the time? I don't. Why do people so dislike libraries?

I don't dislike libraries, I just thought having some commands like DarkBASIC has, for example, "Make Object Sphere", would be easier for new users to use and understand, and as they progressed along they could learn how to manually build them with code.
Click the pic to go to my development blog!