CodeWalrus

Development => Calculators => Calculator News, Coding, Help & Talk => Topic started by: alexgt on January 24, 2016, 03:55:24 AM

Title: HP Prime Programming Help
Post by: alexgt on January 24, 2016, 03:55:24 AM
This is a cross post from HP Museum:
QuoteI have a question about the LINE_P and TRIANGLE_P commands. Both of them have optional advanced syntax, the help hints that it can be used for 3D functions and the such!! I have a hard time understanding the help on it is could someone could show me and give an example, the help is very appreciated ;)
So basicly I think there is already built in 3D functions for LINE_P() and TRIANGLE_P() O.O *.* O.O
(3D MinePrime here I come!!!)
It would be nice if @timwessman shed some light on the topic ;)

This is my first question here but feel free to post your own troubles ;)
Title: Re: HP Prime Programming Help
Post by: Dream of Omnimaga on January 24, 2016, 05:55:03 AM
Well, TRIANGLE_P has been around for a while already and is indeed a 3D command. There are probably some instructions somewhere, but of course to do proper 3D models you would need 3D knowledge and perhaps a way to convert blender models to calc. LINE_P got some 3D capabilities a while ago too but I assume it's for wireframe 3D. And there's also the FILLPOLY_P command which lets you draw a single polygon with an opacity level of your choice (and using a fullscreen polygon even lets you do fade-in/out animations.

The syntax for FILLPOLY_P is something like this:

FILLPOLY_P(G3,{{0,0},{320,0},{320,0},{320,0}}, #000000, 128);

TRIANGLE lets you draw multiple polygons (with some gradient IIRC) in one go, but it lacks opacity support.
Title: Re: HP Prime Programming Help
Post by: alexgt on January 24, 2016, 07:41:44 AM
Triangles have opacity now, and the help section on LINE_P and TRIANGLE_P expanded quite a lot, so the functions were probably there they just didn't show up in the help section. I could learn how to do it if I could find a example program somewhere though...
Title: Re: HP Prime Programming Help
Post by: Dream of Omnimaga on January 24, 2016, 08:31:20 AM
Wait they do? O.O I didn't know that. Imagine how fast the 3D grapher app would be now. The author used TRIANGLE back when it lacked opacity and it ran fast, but then switched to FILLPOLY, which looked nicer, but the frame rate dropped since he needed to draw each polygon one by one.

What I am curious about is how does the triangle format compares to Blender format and stuff like that? That said, even if you got an actual 3D model to show up, it would just be a single color (or with a gradient), so TRIANGLE would be more suitable for simple objects such as a spaceship. FILLPOLY would probably be quite slow and polygon sorting done manually would be hard to implement (and even slower)

What I would be more interested in is if mode-7 would be fast enough in HP PPL.
Title: Re: HP Prime Programming Help
Post by: alexgt on January 24, 2016, 03:21:18 PM
what is mode 7?!
Title: Re: HP Prime Programming Help
Post by: SiphonicSugar on January 25, 2016, 04:11:17 AM
Lol

Is it kind of like Fix?
Title: Re: HP Prime Programming Help
Post by: alexgt on January 26, 2016, 02:40:03 PM
So here is a link that Hans @ hp museum gave me which help a lot.
http://www.hpmuseum.org/forum/thread-5122.html
Title: Re: HP Prime Programming Help
Post by: Dream of Omnimaga on January 26, 2016, 05:30:06 PM
Awesome. Speed-wise I think it should be fine, but it depends how many 3D models you need to draw.
Title: Re: HP Prime Programming Help
Post by: alexgt on January 26, 2016, 07:30:04 PM
I was thinking 3D MinePrime soo probably 100+ triangles :P
Title: Re: HP Prime Programming Help
Post by: Dream of Omnimaga on February 20, 2016, 07:08:03 AM
Wait @alexgt , are you planning to make Mineprime in 3D? Because that might be quite hard because of all blocks being individual blocks rather than just one big map model. It might be better to experiment with smaller stuff first (and finish Mineprime 2D) :P

Something I always wondered is if it's possible to display one massive polygon using FILLPOLY and still not have speed issues? Because then that could be a cheap way to get something that ressembles mode 7 (if you managed to make a GROB to polygon model converter, that is, which would probably be hard) and you could probably use multiple polygon models superposed on each others (since FILLPOLY only allows 1 color at a time) so it would look like a mode 7 map.

It might be worth it to attempt mode 7 without FILLPOLY, though, in case that is fast enough.
Title: Re: HP Prime Programming Help
Post by: alexgt on February 22, 2016, 12:59:41 PM
I don't really understand what mode 7 is :P

I will hopefully make a 3D MinePrine game in the future but nothing near as extensive as Crafti, it would be more of a proof of concept