211
TI Z80 / Re: Jumper for the +C
« on: November 11, 2013, 11:38:49 am »
Wow can't wait to see the result
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to. 211
TI Z80 / Re: Jumper for the +C« on: November 11, 2013, 11:38:49 am »
Wow can't wait to see the result
212
Computer Usage and Setup Help / Re: TI Connect being stupid (again)...« on: November 11, 2013, 11:31:21 am »
indeed
Ti connect don't really have problem with me (transfer etc work fine), but if I leave it on my computer, Ti connect made him crash >< 213
Other / Re: Atari2600 Cartridge Reader V2« on: November 11, 2013, 09:46:48 am »
indeed that pretty interesting. Block transfer is really cool
214
TI Z80 / Re: [Axe] - GLib TUTO« on: November 11, 2013, 09:36:34 am »Ui, a tutorial for this, that helps understand how it works a lot I hope too that why I make the lib a lot simpler (and a tuto) The thing I found funny, is as I make the lib simpler, I make it faster 215
TI Z80 / Re: GLIB a graphics axe 3d librairy« on: November 11, 2013, 09:30:36 am »Is GCORE fully functional and finished now ? Well there will have just some little modification in the shader code, but this is almost nothing (and if I find optimization, I'll made update) So, we can consider the GCORE as fully functionnal, yes 216
TI Z80 / Re: GLIB a graphics axe 3d librairy« on: November 11, 2013, 07:47:30 am »
Update of the main lib !! (the readme is not finalized, so please refer for the moment to the tuto)
*multiple camera handling *vertex shader *better system in general *lot of optimisations EDIT fixed version !!! shader now work proprelly, and file is clean : This is the final version =) 217
TI Z80 / Re: [Axe] Ikaruga X« on: November 11, 2013, 07:39:43 am »
I like it . japanese charater is cool
218
TI Z80 / [Axe] - GLib TUTO« on: November 11, 2013, 07:38:34 am »
This is my first tuto ever, so please tell me is something is unclear, or ununderstandable.
New tuto using the new GCORE and final version ! I puting this here, to don't make confusion with other. First of all, please download the file attached to this post, (not in the GLib main thread, 'cause I didn't update it) (GCORE). Last version is 2.0 omega Place it preferably in archive : warning ! this file is pretty huge (6400 bytes !!). I THE BASIS Let's create a rotating cube ! First of all, include the GCORE prog inside of your axe source : Code: [Select] prgmGCORE Once you did this you have access to all the GLib functions. We need to define the 3D coordinates of each point of the cube, so we can rotate and display them afterwards. Those points are just a bunch of data, so no real explanations are needed here : Code: [Select] Data(40r,-40r,40r)->GDB1 Just remember that a 3D point is always defined as X,Z,Y using the standard 3D axis (X goes from left to right, Y from down to up and Z from near to far). Each coordinate takes 2 bytes, so don't forget the r. By default GLib has no camera defined. So we must specify what type of camera we want to use. In this example, I want to be able to rotate my cube : this is a GMODELVIEW camera (I don't want the camera to move, only the model to rotate). If we actually wanted to have a worldview (fps mode) camera, we would use the °GWORLDVIEW constant. The function to define a camera is : Code: [Select] GNewCam(pointer to camera) **But but but .... I don't know how to create my camera, and I need a pointer to it ! STOP don't worry, GLib provides two pointers to some really basic cameras ! These are the °GMODELVIEW and °GWORLDVIEW cameras. So I just give one of those pointers to the function and my new camera is created : Code: [Select] GNewCam(°GMODELVIEW) Glib also need a special structure, allowing easy vertex processing/clipping. It's called a VBO : vertex buffer object. Basically, it's just a ram area.You need at the begining of your program to generate such structure : This is the command used : Code: [Select] GGenVBO(size,data_to_match) your size is the number of vertices you want to have.data_to_match is the raw (not processed) vertices coordinates (here it's GDB1) It also set the current VBO to the one created , so it will be used by all other command. The function return a special value, that you have to store somewhere : it's the VBO id. We now have this : Code: [Select] GGenVBO(8,GDB1)->G Now we can start the main loop, with 3D calculations : Code: [Select] While 1 this piece of code "update" (transform the vertices) for the specified VBO. You can see that we are passing the id we have previously store. 0 and 7 are the start and the end of vertices we should transform. Here it transform from the vertx 0,...., to the vertx 7 (the last one) And now we want display our points. GLib provide the Code: [Select] GVBOPoint(id_vertex) function to retrieve a point from VBO. It's store the x-coord and y-coord on screen to GScreenX and GSreenY var (alias OP1 and OP1+2)It also return in hl a clipping information : 0 if the point is visible, anything else (=/= from 0) We can now write this : Code: [Select] For(M,0,7) the code loop from the first vertice, to the last one, retrieve on screen coordinate and then disp it if it is visible. We need now to handle the arrow keys, so we can rotate our cube. GLib provides an in-built function, which handles everything (life is beautiful isn't it ) It's the GGetkey function. The call is: Code: [Select] GGetkey() End of the code : Code: [Select] GGetkey() Now time to compile it ... aaaaaaaaaand ... It works ! II Let's put some line Well, let's take the previous code we used. He only display dot point, that not super funny. So let's put some line in there !! In fact, there is almost nothing more to add to your code. I want to display line, and possibly clipped lines between them. We don't want to draw point, so the previous for() loop is useless. GLib provide one function for this : Code: [Select] GClipLine(ID_vertex1,ID_vertex2) This is assuming that a VBO has been set.We need however to know what vertices will be linked with. So let's create a list of ID's. Just to remember though : Code: [Select] Data(40r,-40r,40r)→GDB1 .vertex ID 0 The link between vertices will be handle by an for loop and a constant list (containing the correct vertex ID to link) so we now have : Code: [Select] Data(0,1,2,3,4,5,6,7)->°LinkList and : Code: [Select] For(M,0,11) .there is 12 line to draw in a cube combining all of this , aaaaaaaaand (yes I like big and) : well I fail in the link data list --' exercice : find the right data list :p the whole code, as ever : Spoiler For Spoiler: correction of the exercice : Spoiler For Spoiler: III Shaders (part 1) you may wonder what is a shader, and what you can do with it. In fact, the shader is a way to override the static pipeline of the 3D calculations. You are able then to do a lot of thing with it. However, some vars, (r3 to r6) musn't be used inside shader functions, due to GLib using these. Well, anyway, let get started ! The standard function to set a shader is : Code: [Select] GVertexShader(adress_of_function,sub_adress_projection) you can of course get the adresse with the L operator.sub_adresse_projection is kindy tricky. It is the adresse in your shader, where th projection calculation starts. Once you've put this code, anywhere in your program, GLib's functions will get override. So let's see what you have to put inside this function. Code: [Select] Lbl Shader because some function need a correct hl you mostly want to restore it. As GLib do a goto before, hl get ecrased. But we have a variable to restore it a very basic shader (do nothing more than the GLib's GVertex command) would be then this: Code: [Select] Lbl Shader it's first call the fuction who convert the r1,r2,r3 (and need r3 in hl) to the rotated coordinate in 3D space into OP1+6 Code: [Select] GRotate(x,z,y) You will then have the vertex rotated coordinate to these variable :Code: [Select] GVertexX Then it call the projection function to retrieve the x,y coordinate on screen Code: [Select] GProject() ...and you can retrieve the 2D coordinate to these vars : (note that this function keep the 3D coordinates safe) Code: [Select] GScreenX Based on this you can either : -modify the vertex position before any rotation or after -build your own rotation routine and projection (for example to have more precision) -and everything you want... Once you've done with the shader, you can disable it by doing : Code: [Select] GVertexShader(°GLIBFUNC) yep it's the same function pretty easy isn't it ?let's create a custom shader then The goal is to make the camera moving up and down like in old fps. When the player is not moving, there should be no mouvement. Let create a vars T who hold the current active/not active state. Each frame, compare the X,Y coordinate of the player with previous stored one. (A,B) - if it different, increase the Z var, use to hold an angle : the cosinus will give us the mouvemnt. We now have this as shader : Code: [Select] Lbl TEST for each vertex, the point will be move on screen. And then in the main loop, add this: Code: [Select] 0->T and with variables initialisation : Code: [Select] 0->A->B->T So the whole code is : (note that I change vertices to be more a world thing) Spoiler For Spoiler: well, screen have different vertices but run the same shader : One thing to remember : DO NOT USE r4 to r6 !!. r1-r3 are fine though (but only after rotating) IV And then come polygons.... [WARNING OUTDATED ] the polygon system is in a separate library. So to use it, download the GPOLYGON file, and then put : Code: [Select] prgmGPOLYGON a little warning : GPOLYGON is in alpha, bug may still there ! (and so ram clear too =\) at the begin of your program, after the inclusion of the GCORE file. You can then acess all the new functions ! There is 3 extremely important function : Code: [Select] GDrawArray(adr_array,nb_of_poly) I'll first explain GSetColor and GDrawArray, later GPrimitive GSetColor is I guess pretty obvious. It is used to set the current drawing color. Two flag are possible : °GBLACK or °GWHITE (yes, it's constants) every polygon drawn will have the color you set. Black is the default color. GDrawArray can draw polygons according to a big bunch of datas. Data have a particular structure : Code: [Select] Data(Type_polygon,Color This function handle 3 type of polygon, with a special one : -triangles type is °GTRI -quadrilater type is °GQUAD -sphere type is °GSPHERE the number of vertices you want to put is obviously the number of vertices in the polygon. Why I say sphere is a special thing ? Cause data structure is different : Code: [Select] Data(type,color) where the centerVertexId is the id of the vertex representing the center of the sphere. and then the GPrimitive function. I guess this is the most difficult. the GPrimitive function take in input the pointer to a list of vertices' id, an you must set a particular variable before the call ; the GPolygon var. Simply put the type ( the constant ) in it. The call will the look like this : Code: [Select] GSetColor(°GBLACK) it wil draw, in black, a triangle between the first three vertex. One last thing before the test code though, you remember the GVAdr and GVStr variables for the line clipping ? Well polygon work the same. Every function need correct value in these var. Meaning that you have to rotate your vertex, store them, before call the Polygon function. If a polygon you draw goes crazy, look if you don't forget this part. And now, a little test program: Code: [Select] .TEST not much change ,heh ? and the screen =) still pretty strong, running at 20fps with a fully clipped model. V VBO, extra functions, and pipeline informations... We have already talked about VBO ... but how they work precisely ? follow the guide ! VBO are just a free place in memory, with an particular structure, and an id. What is a VBO Id ? In fact, it is no more than the adress of the start of it. Base on that, we can perfectly create our own VBO, without passing by the GGenVBO() command.You can perfectly, is L3 has been perfectly set up use this : Code: [Select] GSetCurVBO(L3) Bascially this command will change the current active VBO (read : used for rendering) to the one you specify. So, what is this particular structure ? It is the following : Code: [Select] .1 bytes -- reserved field for GLib's, used for delete VBO (you don't really need this) the screen coordiante is separate as follow : Code: [Select] .2 bytes X coordinate the cliping code can be computed, if the vertex position to classify is in the GVertexX to GVertexZ vars with : Code: [Select] GInFrustrum()/256 and return vertex status in hl :-0 if the point is visible -anything else if not Now more about the GLib's pipeline. In fact, when you want to draw a line, or any polygon, the classical pipeline will be : -green : vertex operation -red : shader -blue : geometric operation -white : outside GLib data operation. Indeed, this is a simplified one - especially into the graphics commands. The last stage can be decomposed in many other one, but the GCORE lib doesn't really touch these. It's more the goal of the GPOLY lib (wich is for the moment outdated). Other tutorials are coming, I will then organize this post with them. 219
Axe / Re: AlphaCS Project« on: November 10, 2013, 01:30:24 pm »
well, I can see a lot of optimisation, especially is some structure like :
Code: [Select] If value=0 wich can be optimisated as : Code: [Select] If value every Code: [Select] If value=0 can be change to Code: [Select] !If value You can is some case use the hl register, like in this case : Code: [Select] value->r1 to :Code: [Select] value->r1 this is little tips, I will see if more better optimisations can be done in structure of the program EDIT : this topic may help you to optimize your code : http://ourl.ca/8520 220
TI Z80 / Re: GLIB a graphics axe 3d librairy« on: November 06, 2013, 10:19:39 am »Do you use a rom-dumped rom for wabbit? If not, do it, the others have some wierd bugs. yep it's a calc dumped rom , but this bug still weird 221
TI Z80 / Re: GLIB a graphics axe 3d librairy« on: November 05, 2013, 12:58:06 pm »
no, the glitchy line appears everywhere, due I think to a value who become is some case negative in the triangle draw routine and mess up everything
The clipping however work for every polygon, except quad in some rare case, when the clipping algo gave me 5 vertices, it's just draw only one triangle and exit. 222
TI Z80 / Re: GLIB a graphics axe 3d librairy« on: November 05, 2013, 12:30:30 pm »
Well some screen about what I've done recently : polygon clipping
The shadow thing strangely make everything crash in Wabbit (it open the debugger automatically each time), whereas the prog work fine on the calculator 223
TI Z80 / Re: [Axe] Faces, a 3D space shooter« on: November 02, 2013, 01:21:49 pm »I have no surface texturing, it's only inidividual 3D dots placed on faces o.O Well I guess so, seeing the speed of the whole thing surface texturing is slow 224
TI Z80 / Re: [Contest 2013][Axe] Unnamed SHMUP« on: November 02, 2013, 01:19:42 pm »
look great especially like how the enemies are moving.
225
General Calculator Help / Re: Wabbitemu?« on: November 02, 2013, 01:15:35 pm »
If I rember well this way should work ( this is what I use) : http://www.cemetech.net/forum/viewtopic.php?p=204320
|
|