You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

CKH4's 3D plane program

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0
b/Drawing & Animation publicado por u/CKH4 April 21, 2015, 09:35:36 PM
Even though this is not pixel art I don't think that it deserves a new topic so here's the code for the 3d faked plane.
0->A
While 1
A-pi(K=26)+pi(K=24->A
6cos(.05A->B
sin(.05A->C
If K
ClrDraw
Line(~B,6-C,B,6+C
Line(~B,C-6,B,~6-C
Line(B,6+C,B,~C-6
Line(~B,6-C,~B,C-6
"Leave this out for untextured
For(D,0,6,.65
Line(B/6D-B/2,3+D/5C,B/6D-B/2,~3-D/5C
End
"
getKey->K
End

and here's the image:
Without texture

With texture
Last Edit: April 21, 2015, 09:52:53 PM by CKH4
Inicia sesión o crea una cuenta para dejar un comentario
u/Dream of Omnimaga April 21, 2015, 09:48:41 PM
I like how fast this is despite being BASIC. :) I should try making an HP Prime version when I get a chance.
Last Edit: April 21, 2015, 10:07:19 PM by DJ Omnimaga
u/CKH4 April 21, 2015, 09:51:03 PM
Yeah, feel free to use any of this code if you need it. For basic I think it is pretty well optimized but I haven't tried to hard.
u/Dream of Omnimaga April 21, 2015, 10:09:15 PM
Is it possible to modify that engine to use the screen pixel coordinates rather than graph window?

EDIT: This is what I got after modifying the code a bit by the way. Textures seem glitchy though:
EXPORT plane3D()
BEGIN
DIMGROB_P(G1,320,240,#9EAB88);
0▶A;
WHILE 1 DO
A-π*(ISKEYDOWN(8))+π*(ISKEYDOWN(7))▶A;
6*COS(.05*A)▶B;
SIN(.05*A)▶C;
RECT(G1,#9EAB88);
LINE(G1,−B,6-C,B,6+C,#1A1C16);
LINE(G1,−B,C-6,B,−6-C,#1A1C16);
LINE(G1,B,6+C,B,−C-6,#1A1C16);
LINE(G1,−B,6-C,−B,C-6,#1A1C16);
FOR D FROM 0 TO 6 STEP .65 DO
LINE(G1,−B/2+B/6*D,3+D/5*C,−B/2+B/6*D,−3-D/5*C,#1A1C16);
END;
BLIT_P(G0,G1);
WAIT(.1);
END;
END;



I also tried with GETKEY but it only registers 10 keypresses per second.
Last Edit: April 21, 2015, 10:19:44 PM by DJ Omnimaga
u/alexgt April 21, 2015, 10:21:41 PM
I want to learn the basics of 3D programming like that is there any good how to's out there (I want MinePrime to be 3D in the future!)

DJ I like the fake lcd color like the Z80 ;P
Last Edit: April 21, 2015, 10:23:31 PM by alexgt
u/Dream of Omnimaga April 21, 2015, 10:23:25 PM
Most likely 3D tutorials on Google. IIRC there is a nice raycasting tutorial somewhere too and Critor made a 3D engine in HP PPL. The HP Prime also got FILLPOLY and TRIANGLE commands that can be handy. But yeah i bet that online tutorials can be re-used for calc stuff too.

They can probably be handy for TI-84+ too but much slower of course.

Also with BLIT instead of LINE one could replace the lines with an actual texture if the gaps were removed.
u/alexgt April 21, 2015, 10:27:50 PM
PrimeCaster? Also FILLPOLY had a memory issue even when I used the example in the help menu. Thanks for the help :) !
u/CKH4 April 21, 2015, 10:43:06 PM
Yeah the I had to hack the texture together do to lack of brain power. Anyways that looks really good. I have no idea how to make a less hacky texture. If you find any way to fix it that would be great. Also is there an hp prime boot free equivalent?
u/Dream of Omnimaga April 21, 2015, 10:49:48 PM
Quote from: alexgt on April 21, 2015, 10:27:50 PM
PrimeCaster? Also FILLPOLY had a memory issue even when I used the example in the help menu. Thanks for the help :) !
Oh it's because the example in the help menu is wrong. The syntax isn't even the right one. I forgot exactly what it is but I think you need to change brackets to parentheses or something else.

Also I think bitmap texture for CKH4 program would not work on the HP Prime because BLIT and DIMGROB don't appear to work at all (most likely the same issue that plagued the HP 39gII), while BLIT_P and DIMGROB_P works fine. So CKH4 engine would not be able to use real textures unless it was ported to pixel-based coordinates instead of window-based ones.
Quote from: CKH4 on April 21, 2015, 10:43:06 PM
Yeah the I had to hack the texture together do to lack of brain power. Anyways that looks really good. I have no idea how to make a less hacky texture. If you find any way to fix it that would be great. Also is there an hp prime boot free equivalent?
The official emulator by HP is free.
u/CKH4 April 21, 2015, 10:56:43 PM
I think that if you add 30 to each line argument you can use pixel based lines.
u/Dream of Omnimaga April 21, 2015, 11:05:50 PM
Do you mean incrementing or multiplying? I tried adding 160 to X and 120 to Y and could get a Walrii centered, but I had to scale it up to 24 times its size. Of course it still has the glitch shown in my screenshot earlier but this is how it looks like and run on-calc:



Each column of the sprite are scaled up horizontally to fill 6 pixels in width, which is why it looks weird.

I wonder if with textures that are 8 pixels in width, raycasting would run fast enough...
Last Edit: April 21, 2015, 11:08:18 PM by DJ Omnimaga
u/CKH4 April 21, 2015, 11:15:56 PM
Cool effect but not to useful long term. I meant for each line to look like this instead:
Line(B+30,6+C+30,B+30,~C-6+30


also where do programs hide on hp prime? nvm I found it.
Last Edit: April 21, 2015, 11:19:45 PM by CKH4
u/Dream of Omnimaga April 22, 2015, 03:21:37 AM
Quote from: CKH4 on April 21, 2015, 11:15:56 PM
Cool effect but not to useful long term. I meant for each line to look like this instead:
Line(B+30,6+C+30,B+30,~C-6+30


also where do programs hide on hp prime? nvm I found it.
By not useful do you mean graphical textures are useless?? O.O
u/Snektron April 22, 2015, 10:20:03 AM
Whoa that looks quite cool
u/CKH4 April 22, 2015, 11:57:53 AM
DJ that's not quite what I meant. That scaling method isn't helpful although it does look pretty cool. If I could see the code for it I might be able to fix it.
Start a Discussion

b/Drawing & Animation

Anything ranging from pixel art to video animations can be showcased here.

61
Topics
Explore Board
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal