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

0 Members and 1 Guest are viewing this topic.

#### CKH4

• Extravagant Sushi
• Super User
• Join Date: Jan 2015
• Location:
• Posts: 872
• Post Rating Ratio: +3/-2
• Gender:
##### 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->AWhile 1A-pi(K=26)+pi(K=24->A6cos(.05A->Bsin(.05A->CIf KClrDrawLine(~B,6-C,B,6+CLine(~B,C-6,B,~6-CLine(B,6+C,B,~C-6Line(~B,6-C,~B,C-6"Leave this out for untexturedFor(D,0,6,.65Line(B/6D-B/2,3+D/5C,B/6D-B/2,~3-D/5CEnd"getKey->KEnd`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+

#### xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Posts: 19016
• Post Rating Ratio: +100/-5
• Gender:
##### 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-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV

#### CKH4

• Extravagant Sushi
• Super User
• Join Date: Jan 2015
• Location:
• Posts: 872
• Post Rating Ratio: +3/-2
• Gender:
##### 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+

#### xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Posts: 19016
• Post Rating Ratio: +100/-5
• Gender:
##### 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()BEGINDIMGROB_P(G1,320,240,#9EAB88);0▶A;WHILE 1 DOA-π*(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 DOLINE(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-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV

#### alexgt

• Just your friendly neighborhood Ninja Stach Fancy Iron Man
• Super User
• Join Date: Dec 2014
• Location: Behind you
• Posts: 2615
• Post Rating Ratio: +6/-1
• Something should go here...
• Gender:
##### 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

#### xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Posts: 19016
• Post Rating Ratio: +100/-5
• Gender:
##### 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-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV

#### alexgt

• Just your friendly neighborhood Ninja Stach Fancy Iron Man
• Super User
• Join Date: Dec 2014
• Location: Behind you
• Posts: 2615
• Post Rating Ratio: +6/-1
• Something should go here...
• Gender:
##### 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

#### CKH4

• Extravagant Sushi
• Super User
• Join Date: Jan 2015
• Location:
• Posts: 872
• Post Rating Ratio: +3/-2
• Gender:
##### 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+

#### xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Posts: 19016
• Post Rating Ratio: +100/-5
• Gender:
##### 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-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV

#### CKH4

• Extravagant Sushi
• Super User
• Join Date: Jan 2015
• Location:
• Posts: 872
• Post Rating Ratio: +3/-2
• Gender:
##### 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+

#### xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Posts: 19016
• Post Rating Ratio: +100/-5
• Gender:
##### 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-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV

#### CKH4

• Extravagant Sushi
• Super User
• Join Date: Jan 2015
• Location:
• Posts: 872
• Post Rating Ratio: +3/-2
• Gender:
##### 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+

#### xlibman

• Omni founder & CW co-founder
• CodeWalrus Staff
• Super User
• Forum Maintenance
• Original 5
• CodeWalrus Supporter
• Join Date: Nov 2014
• Posts: 19016
• Post Rating Ratio: +100/-5
• Gender:
##### 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??
• Calculators owned: TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10
• Consoles, mobile devices and vintage computers owned: Samsung i5510, Nintendo Switch, Playstation TV

#### Snektron

• Lvl 69 Russian Snake
• Super User
• Join Date: Dec 2014
• Location: Netherlands
• Posts: 3165
• Post Rating Ratio: +32/-0
• SSSssssss.....
• Gender:
##### 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...

#### CKH4

• Extravagant Sushi
• Super User
• Join Date: Jan 2015
• Location:
• Posts: 872
• Post Rating Ratio: +3/-2
• Gender:
##### 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.