Author Topic: X_OBJNEWFRAME  (Read 7174 times)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
X_OBJNEWFRAME
« 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
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10695
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_OBJNEWFRAME
« Reply #1 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.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: X_OBJNEWFRAME
« Reply #2 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

Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10695
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_OBJNEWFRAME
« Reply #3 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....

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1634
  • Particle Hawk
    • View Profile
Re: X_OBJNEWFRAME
« Reply #4 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

Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10695
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_OBJNEWFRAME
« Reply #5 on: 2009-Nov-20 »
Yes, that's what I'll do.

Offline Ruidesco

  • Mr. Polyvector
  • ***
  • Posts: 236
    • View Profile
Re: X_OBJNEWFRAME
« Reply #6 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).

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10695
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_OBJNEWFRAME
« Reply #7 on: 2011-Oct-14 »
ok, on the todo.

Offline Ruidesco

  • Mr. Polyvector
  • ***
  • Posts: 236
    • View Profile
Re: X_OBJNEWFRAME
« Reply #8 on: 2011-Oct-14 »
Thank you Kitty! *eager* *eager*

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3363
  • Integrated Brain
    • View Profile
Re: X_OBJNEWFRAME
« Reply #9 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...

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10695
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_OBJNEWFRAME
« Reply #10 on: 2011-Oct-18 »
I think about adding a wireframe mode.

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4178
    • View Profile
    • Portfolio
Re: X_OBJNEWFRAME
« Reply #11 on: 2011-Oct-19 »
I think about adding a wireframe mode.

it would be wonderful, like ELITE or AIR SUPPORT!!

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10695
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_OBJNEWFRAME
« Reply #12 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.

Offline Hatonastick

  • Dr. Type
  • ****
  • Posts: 474
  • Amstrad CPC 6128
    • View Profile
Re: X_OBJNEWFRAME
« Reply #13 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
« Last Edit: 2011-Oct-31 by Hatonastick »
Mat. 5: 14 - 16

Android: Toshiba Thrive Tablet (3.2), Samsung Galaxy Tab 2 (4.1.2).
Netbook: Samsung N150+ Netbook (Win 7 32-bit + Ubuntu 11.10).
Desktop: Intel i5 Desktop with NVIDIA GeForce GTX 460 (Win 8.1 64-bit).

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10695
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: X_OBJNEWFRAME
« Reply #14 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.