- Pixler3D - A Library for 3D z80 Assembly Programs
- 21 Nov 2013 09:04:23 pm
- Last edited by amihart on 21 Nov 2013 09:26:06 pm; edited 1 time in total
I was working on a little library awhile ago called Pixler for the TI-83/84s. Pixler could be used to easily to certain basic 2D graphical things, like draw pixels, draw lines, and draw squares.
I'm now updating my Pixler library to Pixler3D.
Pixler3D will give you the ability to draw points in three dimensions. It will also have subroutines to draw planes and rectangular prisms.
Note that all of these 3D shapes are wireframe.
They're not filled in, because if you did that, it would just be all black.
Also, since I don't have the TI-84 Color, I haven't ported this to it yet. I will do so once I get it, though. And I plan to get one near the end of next month.
I know how to do rotations in most other languages, but with z80 Assembly, I'm sure to have trouble with rotations, so I might not release that part for awhile. I do plan on doing them, though. I'm only a high school student, so cut me some slack.
So far, though, I have a 3D cube working. It needs some more work and stuff.
When you define points, I made a subroutine called "DefinePoint" and "DefinePointISO". "DefinePoint" creates points with a sort of perspective 3D. By this, I simply mean that the greater the depth of the point, the more it bends towards the center of the screen. This gives an illusion of 3D, like you would see in most 3D games. If the depth increases, this also results in the shape appearing to grow smaller, as if it's getting farther away. "DefinePointISO" gives you isometric 3D. The greater the depth, the more the cube is translated up and to the left. It does not curve towards the center. This is 3D you would see in most isometric games, like RTS games.
Here is an example of rectangular prism:
Note that it does not flicker and runs much smoother on the actual calculator than the emulator that I recorded that GIF on.
Currently, creating a cube would be done like this:
Code:
Note that (0,0,0) is not the top-left corner of the screen, but the center of the screen.
Anyways, yeah. That's one thing I'm working on.
I'll post the ".inc" file once I get it all nice and generally working.
I'll also post it as an environment variable for Mimas in which you could include into your Mimas programs.
That's basically how it's going to work.
I'm now updating my Pixler library to Pixler3D.
Pixler3D will give you the ability to draw points in three dimensions. It will also have subroutines to draw planes and rectangular prisms.
Note that all of these 3D shapes are wireframe.
They're not filled in, because if you did that, it would just be all black.
Also, since I don't have the TI-84 Color, I haven't ported this to it yet. I will do so once I get it, though. And I plan to get one near the end of next month.
I know how to do rotations in most other languages, but with z80 Assembly, I'm sure to have trouble with rotations, so I might not release that part for awhile. I do plan on doing them, though. I'm only a high school student, so cut me some slack.
So far, though, I have a 3D cube working. It needs some more work and stuff.
When you define points, I made a subroutine called "DefinePoint" and "DefinePointISO". "DefinePoint" creates points with a sort of perspective 3D. By this, I simply mean that the greater the depth of the point, the more it bends towards the center of the screen. This gives an illusion of 3D, like you would see in most 3D games. If the depth increases, this also results in the shape appearing to grow smaller, as if it's getting farther away. "DefinePointISO" gives you isometric 3D. The greater the depth, the more the cube is translated up and to the left. It does not curve towards the center. This is 3D you would see in most isometric games, like RTS games.
Here is an example of rectangular prism:
Note that it does not flicker and runs much smoother on the actual calculator than the emulator that I recorded that GIF on.
Currently, creating a cube would be done like this:
Code:
bcall(_GrBufClr)
ld a, 0
ld (_pixler_cube_x), a
ld (_pixler_cube_y), a
ld (_pixler_cube_z), a
ld a, 10
ld (_pixler_cube_width), a
ld a, 10
ld (_pixler_cube_height), a
ld a, 10
ld (_pixler_cube_depth), a
call defineCube
call drawCube
bcall(_GrBufCpy)
Note that (0,0,0) is not the top-left corner of the screen, but the center of the screen.
Anyways, yeah. That's one thing I'm working on.
I'll post the ".inc" file once I get it all nice and generally working.
I'll also post it as an environment variable for Mimas in which you could include into your Mimas programs.
That's basically how it's going to work.