Join us on Discord!
You can help CodeWalrus stay online by donating here.

CKH4's 3D plane program

Started by CKH4, April 21, 2015, 09:35:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CKH4

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
  • Calculators owned: TI-83+, TI-84+


Dream of Omnimaga

#1
I like how fast this is despite being BASIC. :) I should try making an HP Prime version when I get a chance.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

CKH4

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.
  • Calculators owned: TI-83+, TI-84+


Dream of Omnimaga

#3
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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

alexgt

#4
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
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Dream of Omnimaga

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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

alexgt

PrimeCaster? Also FILLPOLY had a memory issue even when I used the example in the help menu. Thanks for the help :) !
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

CKH4

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?
  • Calculators owned: TI-83+, TI-84+


Dream of Omnimaga

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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

CKH4

I think that if you add 30 to each line argument you can use pixel based lines.
  • Calculators owned: TI-83+, TI-84+


Dream of Omnimaga

#10
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...
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

CKH4

#11
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.
  • Calculators owned: TI-83+, TI-84+


Dream of Omnimaga

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
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

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.
  • Calculators owned: TI-83+, TI-84+


Powered by EzPortal