r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[rebcode] Rebcode discussion

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
[1402x3]
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
has
For people with Linux, maybe this will work: http://www.rebol.net/builds/042/rebview1350042.tar.gz
(I don't know, if that include rebcode!?)
Henrik
2-Apr-2006
[1405]
works now. 33-50 fps
Geomol
2-Apr-2006
[1406]
wow! :) What hardware?
Henrik
2-Apr-2006
[1407]
2.6 Ghz celeron PC. interesting since this PC is usually very slow 
for rebol graphics
Geomol
2-Apr-2006
[1408]
ok, I get 20 fps on a 1.2 GHz G4 Mac.
Henrik
2-Apr-2006
[1409x2]
seems about right clock for clock
in your screenshot the sky is grey but it's white here?
Geomol
2-Apr-2006
[1411x2]
How many RHz do you get with: http://www.rebol.com/speed.r
The snapshot may have been done with a slightly different version. 
I play with the colours.
Henrik
2-Apr-2006
[1413]
Console:   0:00:12.979 - 39 KC/S
Processor: 0:00:00.801 - 1078 RHz (REBOL-Hertz)
Memory:    0:00:02.023 - 23 MB/S
Disk/File: 0:00:00.991 - 30 MB/S
Geomol
2-Apr-2006
[1414]
I get around 760 RHz
Henrik
2-Apr-2006
[1415]
which terminal program do you use?
Geomol
2-Apr-2006
[1416]
So, makes sence.
Henrik
2-Apr-2006
[1417]
I get 345 on the mac
Geomol
2-Apr-2006
[1418]
The standard Terminal incl. in MacOSX
Henrik
2-Apr-2006
[1419x2]
same here
but...
Geomol
2-Apr-2006
[1421]
Maybe you have some background program running on the mac stealing 
CPU?
Henrik
2-Apr-2006
[1422]
I get 222 kc/s in the OSX console, where the Windows console only 
gives 39 kc/s
Geomol
2-Apr-2006
[1423]
Computers are strange and difficult to compare. :)
Henrik
2-Apr-2006
[1424x2]
there is something that massively slows down the console under windows. 
I get the same slowness under View with most programs.
testing the same programs under slower PC's yield better results 
than this one