* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: CKH4's 3D plane program  (Read 5674 times)

0 Members and 1 Guest are viewing this topic.

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
CKH4's 3D plane program
« on: 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.
Code: [Select]
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 »


  • Calculators owned: TI-83+, TI-84+


Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18730
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #1 on: 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 »
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #2 on: 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.
  • Calculators owned: TI-83+, TI-84+


Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18730
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #3 on: 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:
Code: [Select]
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 »
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2611
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #4 on: 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 »
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18730
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #5 on: 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.
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2611
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #6 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 :) !
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #7 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?
  • Calculators owned: TI-83+, TI-84+


Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18730
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #8 on: April 21, 2015, 10:49:48 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.
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-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #9 on: April 21, 2015, 10:56:43 pm »
I think that if you add 30 to each line argument you can use pixel based lines.
  • Calculators owned: TI-83+, TI-84+


Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18730
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #10 on: 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 »
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #11 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.
« Last Edit: April 21, 2015, 11:19:45 pm by CKH4 »
  • Calculators owned: TI-83+, TI-84+


Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18730
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #12 on: April 22, 2015, 03:21:37 am »
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-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3165
  • Post Rating Ratio: +32/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • quantuminfinity
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #13 on: April 22, 2015, 10:20:03 am »
Whoa that looks quite cool
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: CKH4's 3D plane program
« Reply #14 on: 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.
  • Calculators owned: TI-83+, TI-84+


 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games