GLBasic forum

Feature request => 3D => Topic started by: Hemlos on 2009-Nov-19

Title: X_OBJNEWFRAME
Post by: Hemlos on 2009-Nov-19

X_OBJSTART ID

X_OBJADDVERTEX
X_OBJNEWGROUP
X_OBJADDVERTEX

X_OBJNEWFRAME //increment to the next frame #

X_OBJADDVERTEX
X_OBJNEWGROUP
X_OBJADDVERTEX

X_SAVEOBJ Name$

Make the command so it is used exactly like OBJNEWGROUP
Title: Re: X_OBJNEWFRAME
Post by: Kitty Hello on 2009-Nov-19
Nice idea. I would make a X_DRAW_WIRE instead, though. Because it's really hard to mix wireframe and triangles in one model.
Title: Re: X_OBJNEWFRAME
Post by: Hemlos on 2009-Nov-19
Thats too bad, im not sure i completely understand what a Draw_Wire will do.
My idea wass to use the bezier library to make some really cool animated objects in GLBasic...like water surfaces etc

Title: Re: X_OBJNEWFRAME
Post by: Kitty Hello on 2009-Nov-19
Yes. And I thought it would be cool to have a mode where you can create a model, but instead of triangles the connected lines are drawn as lines. I see what you mean. With triangles some lines are drawn twice... Hmm....
Title: Re: X_OBJNEWFRAME
Post by: Hemlos on 2009-Nov-20
Err, again, i dont think i understand what you mean....im not an opengl expert like you.
How is this related to drawing multiple frames?

To draw lines, i already did this with X_LINE and X_GETFACE, in the 3dobjectanalyzer and its slow.

Quentin found a wireframe mode in opengl, looks easy enough to implement(which i will add to the 3doa one of these days) :
http://www.glbasic.com/forum/index.php?topic=3730.msg27127#msg27127

Title: Re: X_OBJNEWFRAME
Post by: Kitty Hello on 2009-Nov-20
Yes, that's what I'll do.
Title: Re: X_OBJNEWFRAME
Post by: Ruidesco on 2011-Oct-14
Apologies for reviving a long dead thread, but it's on the first page and it would be redundant to make a different one to ask for the same.

Is this feature going to be implemented sometime?
Defining multiple frames for 3D objects created at runtime is the only thing missing in the "X_OBJ" list of commands, since it is already possible to load objects made with external utilities which have multiple frames.
Personally it would be a lifesaver, since I am using a simple format of my own (I'm trying to make something voxel-related).
Title: Re: X_OBJNEWFRAME
Post by: Kitty Hello on 2011-Oct-14
ok, on the todo.
Title: Re: X_OBJNEWFRAME
Post by: Ruidesco on 2011-Oct-14
Thank you Kitty! *eager* *eager*
Title: Re: X_OBJNEWFRAME
Post by: mentalthink on 2011-Oct-15
Well drawlines in 3D objects I think it´s cool, the utility can be for a retro-intro like Aliens of something esquematics, I think not it´s a bad idea, the most part of 3D suites can show the lines, and another utility if you make a 3D modeler, it´s very important have this point for know in what part of the model you are...

But make water and distortion objects can be very great...
Title: Re: X_OBJNEWFRAME
Post by: Kitty Hello on 2011-Oct-18
I think about adding a wireframe mode.
Title: Re: X_OBJNEWFRAME
Post by: erico on 2011-Oct-19
Quote from: Kitty Hello on 2011-Oct-18
I think about adding a wireframe mode.

it would be wonderful, like ELITE or AIR SUPPORT!!
Title: Re: X_OBJNEWFRAME
Post by: Kitty Hello on 2011-Oct-19
Elite - IIRC - has a hidden-line wireframe mode. That's different. You can do this with proper texturing now. Otherwise you would have to draw a solid black object and overlay the wireframe.
Title: Re: X_OBJNEWFRAME
Post by: Hatonastick on 2011-Oct-31
The suggested above commands are an absolute must for my main game idea which will be retro 3D in appearance.  I really need to be able to mix in wireframe (not hidden-line wireframe) and to be able to procedurally generate simple objects and animate them.  No rush though, wont be starting on that until after my first project.  =D
Title: Re: X_OBJNEWFRAME
Post by: Kitty Hello on 2011-Oct-31
Code (glbasic) Select

// Simple 3D
LOCAL phi

DRAWRECT 0,0,64,64,RGB(255,255,0)
DRAWRECT 10,10,23,23,RGB(0,0,255)
PRINT "GLBASIC", 0,32
GRABSPRITE 0, 0,0,64,64


MakeObjectA(1)
MakeObjectB(2)


WHILE TRUE
phi=GETTIMERALL() * 0.10

X_MAKE3D 1, 2500, 45
X_CAMERA 0,0,120, 0,0,0

// cullmodes -1; 0; +1
FOR cmode=-1 TO 1
IF cmode
X_SETTEXTURE 0, -1
ELSE
X_SETTEXTURE -1, -1
ENDIF
X_CULLMODE cmode
X_MOVEMENT cmode * 50, 0, 0
X_ROTATION phi, 0, 1, 0
X_DRAWOBJ 1, 0
NEXT

// draw an user-created animated object.
X_CULLMODE 0
X_MOVEMENT 0,-30,0
X_DRAWANIM 2, 0, 2, FMOD(GETTIMERALL()/2000., 1.0), TRUE

SHOWSCREEN
WEND




FUNCTION MakeObjectA: id%
// simple polygon shaped 3D object
X_OBJSTART id%
X_OBJADDVERTEX   40,  0, -50,  1,1, RGB(255,255,255)
X_OBJADDVERTEX   40, 40, -50,  1,0, RGB(  0,255,  0)

X_OBJADDVERTEX   30,  0, -20,  0,1, RGB(255,255,255)
X_OBJADDVERTEX   30, 40, -20,  0,0, RGB(  0,255,  0)

X_OBJADDVERTEX   20,  0, 0,  0,1, RGB(255,255,255)
X_OBJADDVERTEX   20, 40, 0,  0,0, RGB(  0,255,  0)
X_OBJADDVERTEX  -20,  0, 0,  1,1, RGB(  0,  0,255)
X_OBJADDVERTEX  -20, 40, 0,  1,0, RGB(  0,  0,255)
X_OBJEND
ENDFUNCTION




FUNCTION MakeObjectB: id%
// simple polygon shaped 3D object, with 3 animation frames
LOCAL col%  =RGB(255,255,255)
X_OBJSTART id%
FOR fr% = 0 TO 2
X_OBJSETFRAME fr%

X_OBJADDVERTEX   0,     0,0,   0.5, 0, col%
X_OBJADDVERTEX  30,-fr*10,0,  1  , 1, col%
X_OBJADDVERTEX -30,-fr* 5,0,   0  , 1, col%
NEXT
X_OBJEND
ENDFUNCTION


Sorry, I didn't plan to bring the update w/o a proper setup and the iOS compiler, but serious bugs forced me to. Above is the "simple3d" example that will be shipped next.
Title: Re: X_OBJNEWFRAME
Post by: Hatonastick on 2011-Oct-31
Wow, nice one mate!  :good:
Title: Re: X_OBJNEWFRAME
Post by: Ruidesco on 2011-Oct-31
And it already works! :nw:
Title: Re: X_OBJNEWFRAME
Post by: Hatonastick on 2011-Nov-01
Wow, it does too!  Brilliant!  Just need to update help now then.  =D

Edit: Also will wireframe of some sort be possible as well some time in the future?