World: r3wp
[rebcode] Rebcode discussion
older newer | first last |
Oldes 3-Dec-2005 [1353] | form = for |
DideC 3-Dec-2005 [1354x2] | I think Gabriele has work on that IIRC |
work=worked | |
Oldes 3-Dec-2005 [1356] | Maybe it would be goot to have some registers in rebcode to store temporary values which are needed for more cmplex calculations (no need to set named variables) |
Anton 3-Dec-2005 [1357] | Yeah, I was thinking about that, too. Maybe someone with more experience in this area can comment. |
Oldes 3-Dec-2005 [1358x4] | Added to Rambo (with bug in the example:( http://www.rebol.net/cgi-bin/rambo.r?id=-505& |
and with bug in my english as well: goot = good :( | |
Fast atan2 function: do http://box.lebeda.ws/~hmm/rebol/rebcode/latest/rc_atan2.r | |
Based on this C code: http://www.dspguru.com/comp.dsp/tricks/alg/fxdatan2.htm | |
Anton 3-Dec-2005 [1362] | How accurate is it ? |
Oldes 3-Dec-2005 [1363x4] | just do the usage block to see |
It could be more accurate, but I don't know how to do [ r^3 ] in rebcode (where r is decimal) | |
But I think the accuracy is fine if you are doing animations and effects based on atan2 function - where speed is more important than precision | |
sorry, wrong link, should be: do http://box.lebeda.ws/~hmm/rebol/projects/rebcode/latest/rc_atan2.r | |
Anton 4-Dec-2005 [1367x3] | Mmm.. It looks slower than ARCTANGENT |
Can you put the rebol equivalent (non-rebcode) alongside the atan2 examples, in the Usage ? | |
(about 20% slower, by the way. But I'm not confident of my quick tests.) | |
Rebolek 5-Dec-2005 [1370] | How can I access values in objects from rebcode? (when rebcode is not in the same context) |
Oldes 5-Dec-2005 [1371x2] | Anton: it's logical, Arctangent is one opcode in the rebcode |
Kru: I don't know, write it to Rambo as a wish if you wish:) | |
Rebolek 5-Dec-2005 [1373x2] | Yes, I wish :) I think something like: pick x object value |
But maybe it's possible now, I just don't know how. | |
Anton 5-Dec-2005 [1375] | Oldes, what's the advantage to your rebcode algorithm then ? |
Oldes 5-Dec-2005 [1376] | atan2 <> atan |
Rebolek 5-Dec-2005 [1377] | atan2 is not very well chosen name, it's pretty confusing. but that's not Oldes' fault |
Anton 5-Dec-2005 [1378] | Oh I see now. :) |
Gregg 5-Dec-2005 [1379] | To access objects, you need to escape out of rebcode. Remember (everyone), use rebcode only when you need it. |
Rebolek 6-Dec-2005 [1380] | As I work with sound synthesis and 3d graphics I use lot of maths so I need rebcode imost of the time :) I had data structures using objects, so I rearanged them for now. I wrote it as wish to RAMBO. |
Volker 6-Dec-2005 [1381] | You can use 'third, 'get and 'set to turn objects into blocks. only from the rebol-side, but maybe it helps a bit. |
BrianH 8-Dec-2005 [1382] | Kru, you can use apply in or apply bind to get a word bound to the object field, and then use setw and getw to get at the values. |
Henrik 12-Dec-2005 [1383] | Continuing from SDK group: I noticed that cyphre thinks pixel writing and reading can be a bottleneck in the current rebcode implementation, which is why the native convolve functions in rebol/view 1.3.2 are much faster than the rebcode version demonstrated earlier. By providing ways to read and write RGBA information directly without needing to extract and combine them first, rebcode could be faster at per-pixel operations. Any thoughts on how to do this? |
Pekr 12-Dec-2005 [1384] | allow tuples for rebcode? |
Geomol 12-Dec-2005 [1385] | I got an email from Carl at one point regarding this issue. I asked to have poking of tuples in rebcode. Carl wrote: Regarding below, tuple poke not supported on images. But, perhaps it makes sense to add that, eh? As I also see it, adding support for tuple datatype from within rebcode is a good solution. Carl is aware of it, it seems, so just *poke* him once more and ask for that. It should also work with PICK of course (reading pixels). |
Pekr 13-Dec-2005 [1386] | So, has anyone the idea of possible syntax to work with pixels in rebcode, so that we could submit an enhancement? |
Geomol 13-Dec-2005 [1387x2] | For writing: poke img 1 255.255.255 or with alpha: poke img 1 255.255.255.255 |
I'm a bit in two minds about this. Reading is done with PICK, but it'll return an integer. So how to make it return a tuple? Something like: pick.tuple result img 1 Not so good, eh? Maybe we need a TO-TUPLE command in rebcode. And how will it influence performance? Maybe it isn't such a great idea to add support for tuples to rebcode!? | |
Rebolek 13-Dec-2005 [1389] | hmm, 'to-tuple is not bad. it's just a graphical interpretation of bytes in memory. there's no difference between 16777215 and 255.255.255 . It's just parser's job. |
Henrik 13-Dec-2005 [1390x2] | shouldn't it be an op-code? like TUPLE-PICK, only a slightly less goofy name :-) |
or, we have . notation: PICK.T | |
Ashley 13-Dec-2005 [1392] | tick and toke? ;) |
Geomol 14-Dec-2005 [1393x2] | Hmm, now I think about it once more, maybe a special PICK isn't needed. The internal representation of values, whether they are seen as integers or tuples, can be the same. If we name each of the components of a 4 part tuple red, green, blue and alpha, the following holds: integer = (alpha * (2 ** 24)) + (red * (2 ** 16)) + (green * (2 ** 8)) + blue What we need, is the ability to tell values as tuples as well as integers. Internal they are the same. I would like to be able to do this: poke img 1 16843009 poke img 1 1.1.1.1 pick result img 1 eq.i result 16843009 eq.i result 1.1.1.1 |
But again, it might hit performance too much, because the parser needs to check, if an integer is written as an integer or as a tuple. | |
Pekr 14-Dec-2005 [1395] | special opcodes wouldn't hurt imo ..... |
Volker 14-Dec-2005 [1396] | pick.byte? |
Geomol 2-Apr-2006 [1397x2] | I've made a test of a voxel landscape engine in rebcode. As I did it on my Mac, it's written in the version of rebcode found in the version 1.3.50 of REBOL/View from around Oct-2005. I haven't tested it with the Windows version of View, but I guess, it should work with that same version 1.3.50. I first did a plain REBOL version and got a framerate of around 3-4 fps (frames pr. second). With the rebcode version, I get around 20 fps. The script is found here: http://home.tiscali.dk/john.niclasen/voxel/NicomVoxel.r I've also made a snapshot here: http://home.tiscali.dk/john.niclasen/voxel/snapshot.png |
In case someone is interested in trying the script out, you can move around with w, s, a and d. | |
Henrik 2-Apr-2006 [1399] | I get a bug: >> do http://home.tiscali.dk/john.niclasen/voxel/NicomVoxel.r connecting to: home.tiscali.dk Script: "NicomVoxel" (2-Apr-2006) ** User Error: Rebcode syntax error: mul idx cZ add idx cX pickz OldY heightmap idx ** Near: make error! reform [msg copy/part mold/only where 50] |
Geomol 2-Apr-2006 [1400] | Henrik, do you use the version 1.3.50 of View? ;-) |
Henrik 2-Apr-2006 [1401] | 1.3.61 |
Geomol 2-Apr-2006 [1402] | That one have a newer version of rebcode, use the old one. For Mac, use: http://www.rebol.net/builds/024/rebview1350024.tar.gz For Windows, I guess this will work: http://www.rebol.net/builds/031/rebview1350031.exe |
older newer | first last |