![]() |
Forum Index : Microcontroller and PC projects : CMM2: V5.06.00b7 - 3D engine
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
mclout999 Guru ![]() Joined: 05/07/2020 Location: United StatesPosts: 483 |
jirsoft That seems like it was a very efficient method. So, those functions just scan along the scanline for the next boundary color and then draw a line or a segment of a pattern. I guess that for islands in the field it then skip to the next non-boundary color. Is that correct? That might cut way down on the recursion needed or am I wrong. Do you know how they implemented gradient fills? Thanks. UPDATE: While I was typing this matherp posted an update. He is scary fast and responsive on this project. Just amazing. Edited 2020-12-02 00:59 by mclout999 |
||||
LeoNicolas![]() Guru ![]() Joined: 07/10/2020 Location: CanadaPosts: 500 |
Yes, Peter is scary fast. I don't know how he implements these new features so fast. Maybe he lives in a space / time gap and his day has more then 24h. Just kidding. ![]() |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
Pretty dang good. But a quick look at the scanline algorithm shows how to break it: mode 1,8 cls circle 200,200,150 circle 300,200,150 circle 250,275,150 print @(0,500) "Press a key to fill the center with WHITE..." do : loop until inkey$ <> "" pixel fill 250,250,rgb(white) Filling with a colour other than the boundary colour works awesome. Change the colour in the last line to something else, like "red" to see how awesome. The work around is to fill twice, first with a 'safe' colour, then with the desired colour. A 'safe' colour is one that does not appear anywhere on the screen. Edited 2020-12-02 03:48 by vegipete Visit Vegipete's *Mite Library for cool programs. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10075 |
That's easily fixed - try downloading again. I've even made it faster ![]() void floodFillScanline(int x, int y) { if(filloldcolour == ConvertedColour) return; if(ReadPixelFast(x,y) != filloldcolour) return; int x1, xe, xs; //draw current scanline from start position to the right x1 = x; xe = -1; while(x1 < fillmaxW && ReadPixelFast(x1, y) == filloldcolour) { xe=x1; x1++; } if(xe != -1){ DrawHLineFast(x,y,xe,ConvertedColour); } //draw current scanline from start position to the left x1 = x - 1; xs = -1; while(x1 >= 0 && ReadPixelFast(x1, y) == filloldcolour) { xs = x1; x1--; } if(xs!=-1){ DrawHLineFast(xe,y,x-1,ConvertedColour); } //test for new scanlines above x1 = x; if(xe!=-1){ while(x1 <= xe) { if(y > 0 && ReadPixelFast(x1, (y - 1)) == filloldcolour) { floodFillScanline(x1, y - 1); } x1++; } } x1 = x - 1; if(xs!=-1){ while(x1 >= xs ) { if(y > 0 && ReadPixelFast(x1, (y - 1)) == filloldcolour) { floodFillScanline( x1, y - 1); } x1--; } } //test for new scanlines below x1 = x; if(xe!=-1){ while(x1 <= xe) { if(y < fillmaxH - 1 && ReadPixelFast(x1, (y + 1)) == filloldcolour) { floodFillScanline( x1, y + 1); } x1++; } } x1 = x - 1; if(xs!=-1){ while(x1 >= xs) { if(y < fillmaxH - 1 && ReadPixelFast(x1, (y + 1)) == filloldcolour) { floodFillScanline(x1, y + 1); } x1--; } } } |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
Almost perfect. It's not filling single pixel high gaps moving left: mode 1,8 cls circle 200,200,150 circle 300,200,150 circle 250,275,150 text 250,240,"Awesome!","CB",,,rgb(red) line 240,200,260,200,,rgb(blue) line 240,202,260,202,,rgb(blue) line 249,180,249,222,,rgb(blue) line 251,180,251,222,,rgb(blue) print @(0,500) "Press a key to fill the center with WHITE..." do : loop until inkey$ <> "" pixel fill 250,250,rgb(white) The centers of letters are not filled. That is exactly as expected. But look closely at the lower part of the 'e's. This is shown by the double stroke blue cross. Same for various fill colours. Try blue - the cross should become a single black pixel. ========================= On a slightly different topic that doesn't really belong here, would it be possible to add '-1' as a valid fill colour for drawing commands such as box, rbox, polygon, circle etc? ie: box 600,200,50,50,1,rgb(white),-1 behaves the same as box 600,200,50,50,1,rgb(white) Edited 2020-12-02 05:27 by vegipete Visit Vegipete's *Mite Library for cool programs. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10075 |
I posted the source - you could have found the bug for me ![]() if(xs!=-1){ DrawHLineFast(xe,y,x-1,ConvertedColour); } Uploaded once more as b10 |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
Ah, I see it now. 'xe' needs to be changed to 'xs' Yup, everything to excess! Visit Vegipete's *Mite Library for cool programs. |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
New weird thing. If I exit the editor using F1, the underscore cursor is expanded and the system is in some strange video state. The video 'twitches' with the next command, the screen clears, then settles down. Try 'F1' to exit editor, then immediately 'ls[Enter]' to list files. Edited 2020-12-02 06:15 by vegipete Visit Vegipete's *Mite Library for cool programs. |
||||
qwerty823 Newbie ![]() Joined: 30/07/2020 Location: United StatesPosts: 30 |
DRAW3D CREATE with no params locks up the machine. |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10075 |
Seems reasonable. Every bit of extra syntax checking slows the interpreter down. The CREATE command has no optional parameter so why would you expect it to check if you call it without any? OPTIONS? Edited 2020-12-02 08:50 by matherp |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1122 |
OPTIONS? The only option I've set is keyboard repeat. > option list CURRENT VGA mode 800x600 RGB332 CURRENT DISPLAY 50,100 OPTION USBKEYBOARD US OPTION KEYBOARD REPEAT 400,30 Everything else is whatever happens from flashing firmware. Same effect if I enter "option reset" Anything mode command related fixes the problem. Some other commands do too. Generating a syntax error fixes it also. The underscore cursor looks spread apart. The pixels are spaced one pixel apart. The character cell size appears double, although typed text is normal. Also, the CMM2 freezes once I'm 28 or 29 lines down the screen. The cursor disappears off the bottom at line 25 although the prompt character ">" is only half way down. The individual cursor pixels are much more distinct than these photos show. The phote has blurred them together a bit. ![]() ![]() ![]() Visit Vegipete's *Mite Library for cool programs. |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
I had the same issues (cursor), similar OPTIONS, just my KEYBOARD REPEAT 500,80 I have to go back to few versions back, because after short time, my CMM2 locked up. Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10075 |
Rather than give up I really need you to identify the sequence of actions that causes the problems. For example if your are developing NC when this happens and you are using a CSUB then perhaps there is a correlation there. I'm not going back to the 5.05 code base so this problem needs finding and fixing |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
Hi Peter, I will try it again, but yesterday I haven't so much time and needed finish compression... But anyway, for me it wasn't connected to anything, I updated FW, CMM2 started OK, just the cursor was strange -> wrong position and not underline but some characters (########### or !!!!!!!!!!!!!), I tried to change MODE back and forth, then it looked OK. When I switched CMM2 off and after 2 hours backn on again, I got just welcome picture and FW message, but no cursor, no reaction for keys. I tried (blindly) switch the MODE (because I thought it could be for example wrong OPTION CONSOLE), but nothing helped. So I went back... I forgot, I'm not on 5.05 but still 5.06, just some lower RC. Edited 2020-12-02 18:41 by jirsoft Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10075 |
V5.06.00b11 http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip This version fixes a memory corruption that occurs if you leave the editor with F1 It is strongly recommended that you upgrade to this version if you are using any of the V5.06.00 beta versions. Note: The firmware is 758332 bytes long. You are strongly recommended to update using a USB A-A cable rather than over the serial connection. This is a lot of bytes to transfer over serial with no error correction! |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Does the "Verify programming" option in the STM programmer not give us some protection here? Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10075 |
You would hope so but I've definitely seen had problems when programming over serial that don't occur over USB |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
OK, thanks for the warning. For what it is worth I've been programming over serial since the beginning without a single issue, and I would guess have reprogrammed at least as many times as anyone else other than the original CMM2 principals. Tom Edited 2020-12-02 21:57 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
jirsoft![]() Guru ![]() Joined: 18/09/2020 Location: Czech RepublicPosts: 533 |
I think I have no A-A cable, so I will risk serial ![]() Jiri Napoleon Commander and SimplEd for CMM2 (GitHub), Â CMM2.fun |
||||
RetroJoe![]() Senior Member ![]() Joined: 06/08/2020 Location: CanadaPosts: 290 |
Every bit matters :) I would have thought that the STM verification step would catch any garbled bits regardless of the I/O method. It never occurred to me try reflashing over serial, albeit I suppose it would be more in keeping with the “retro” vibe of the CMM2. That being said, the verb “to flash” meant something entirely different in the 1970s :) Most of you will recall that firmware was still very “hard” at the time - I remember how liberating it was when I got my first EEPROM programmer and could mod my Apple II. A related pre-Internet anecdote: I was watching a documentary on Commodore computer a few night ago, and one of the segments had a guy recounting how when he got his first C64 as a kid, he lived in a rural town, and the only way to get software for his machine was by accompanying his mother into “the city” and copying code listings out of magazines by hand while his mother was shopping, then transcribing them when he got home... and repeating those steps in weekly instalments for longer programs! Talk about a lack of error correction! Enjoy Every Sandwich / Joe P. |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |