Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sf-in-sf

Pages: 1 [2] 3 4 ... 7
16
IDE/Syntax / Re: users' themes
« on: 2015-Oct-21 »
Thank you D2O.

17
Hi! I am available to code "anything" -as long as you know what you want. Gaming, maths, physics, 3D are welcome. Please use a personal message to contact me. English, German, French are o.k.
sf-in-sf

18
I remember, http://www.glbasic.com/forum/index.php?topic=9195.msg78678#msg78678  It was probably before I ever used Polyvector.
Are you sure what you get on the right is fractal? Isn't it a simple moire effect?

19
2D-snippets / Re: Randomizing Colors
« on: 2015-Oct-18 »
Quote
Color = 0x808080 + RGB( RND(127), RND(127), RND(127) )
increase the constant value 0x808080 to desaturate the colors. Put 1 or 2 chanels to zero to make a saturated color.
Has anyone noticed? interpolating two rgb colors by interpolating each r/g/b chanel is just UGLY, always too dark and greyish in the middle. Try yourself (what happened to my old code???) if you want a superb gradient from col1 to col2, what you get by mxing pigments on a silk-screen, go to the CMYK values and then interpolate them. See the difference. (cyan magenta yellow black).
Oh lazy me, I need to implement it in my art, now.
========= E D I T ===========
Sorry, I did that a long time ago, I am not completely sure now. RGB <-> CMY is easy but doesn't solve the problem .
The conversion formulas are visible at www.easyrgb.com
Maybe RGB <-> CMYK is better. Anyway I am certain that the bottom line problem is the gamma value used when coding RGB. Not surprising, gamma values are all different for a printer, your monitor screen, and your digital camera, maybe when you scan a film too. So, RGB must be converted to pigment concentrations, using gamma, before the interpolation. The right gamma value will make the middle lighter, more realistic, but not too much.
Apparently my tests disappeared in a HD crash. Sorry,

20
Math / rotation in XY plane
« on: 2015-Oct-18 »
As I used it again today, here is a brief summary. How to rotate a point around the 0,0 origin?
your point is P(x,y). Write it as a complex number, a +ib    i.e. a=x and b=y. When you rotate this point by an angle theta, you multiply this complex number by e^(i theta) = cos(theta) +i sin(theta).
You end up with a rotated point P2{X,Y} with X = a cos(theta) - b sin(theta)  and Y = b cos(theta) + a sin(theta).
If you want to rotate something anywhere in the xy plane, first "move" it to the 0,0 origin, rotate it, and then put it back where it was.
Good luck!

PS X and Y are AXES not planes.
EDIT// // // sorry, X is my favorite plane: "X plane" is a superb flight simulator, FAA certified.

21
IDE/Syntax / Re: users' themes
« on: 2015-Oct-12 »
Hi!
I like your conventional style, D2O. Mine looks like this at the moment. Thank you for the reg tips.
(how did you do it? I am not allowed to upload the reg file.)

22
IDE/Syntax / IDE + code
« on: 2015-Oct-12 »
Hi there!

A)
As a Basic programmer I still want a REM command. It has the same effect as // to start a line, but it's a good old b.a.s.i.c. style. Please, a bit of respect for the elders when doing some "retro" stuff.
B)
For the purpose of code clarity, I wish a command to temporarily change the code's background color, for a particular small section. So it becomes easy to spot the zone when scrolling some long code up and down. It could be named REM_BGCOL. It accepts a color like 0x003300 or rgb(0,51,0), and a DEFAULT value to go back to the standard color. It doesn't work inside an INLINE paragraph. It only talks to the IDE and is always skipped by the compiler.
C)
When some weird behaviour occurs I often wish to have an conditional stop/break/pause/debug function. It's an extension of the DEBUG function, where the breakpoint is triggered by a condition -e.g. some abnormal values, or why not a "catch error" line.
Thank you in advance!

23
Off Topic / Re: Free terrain builder...
« on: 2015-Oct-04 »
Superb result! Great job! Thank you for he link.
See all that can be done by subdividing a surface . . . . . . .

24
Have you seen my example on creating random fractal clouds? The same principle is used to produce random terrain, like a rocky planet or whatever. Same to produce remote random fractal mountains, looking realistic because they are fractal. However I am convinced that using REAL pictures skillfully yields the best results.  Could you describe the game a bit? The context, principle, goal, any preview?

25
GLBasic - en / Re: 6809 CPU (COCO)
« on: 2015-Aug-04 »
I believe you could get the generated c++ code from glB and inject it into a rich c++ compiler like gcc. Don't ask me any details, I never do such jobs. you could look at the stand-alone glB compiler for a start? Good luck!   -oh, what machine uses this processor, by the way?

26
IDE/Syntax / users' themes
« on: 2015-Jun-16 »
Is there a way to share our IDE appearance own themes -fonts and colors? So we could see what others do to make life easier to read on the screen. It's about the user's experience. Please suggest something.

27
Tools / command request
« on: 2015-Jun-16 »
Hi!
It's cool to have FILEREQUEST$ available but it's not enough. It lacks a title for the window, in order to make clear what is the requester for, when you need multiple requesters to locate various things. A title should say, for example, if you wanna read or write/give-a-new-filename...
Unfortunately, I found no FOLDERREQUEST$ (tell me if I am wrong). I need it to input where all the pictures of an album are located. Or, where sorted textures live together. Is there any way around that problem?

28
Hi everyone!
I would like to make my question clearer; using GETTIMERALL() is a polling technique as opposed to real-time interruption. Yes I could include some gettimeral() so the renderer looks at the time regularly, but I don't wish the "logic" to be delayed by all those lookup functions. I would like it to be interrupted automatically by the system's clock/tick/timer/milliseconds. Isn't it what happens when a renderer runs in the background as a thread?
   My goal: getting a responsive touchscreen, while the renderer is easily interrupted anytime. It's not about screen f.p.s. performance! There is an equivalent of what I want: a free Mandelbrot fractal tracer, on the android market. You set the zoom/centering/rotation with your fingers any time, and the renderer works in the background, as long as you don't touch the screen. You understand?
   How can I implement that with glbasic? With some  INLINE C code? Thank you!

(Is it that bad if the original question is a few years old?)

29
Hi!
I am facing an other problem, when I want to transfer my generative pgm to an android tablet for the multi-touch function. (it's more intuitive to use fingers than typing numbers in a console). The logic/renderer can be very long, and it must be interrupted whenever a touch/event happens from the fingers, for a decent responsiveness. What is the way to set a kind of real-time interrupt (or vector) like with the microcontrolers? ...that only reacts to the system ticks/time/clock (usually in ms), independently of the FPS / refresh rate.

In other words, LIMITFPS becomes useless in this case, when the logic takes much longer than the refresh rate. What's the way around it? Thank you!   (Please note: LIMITFPS is v. useful to synchronize some short logic with a steady frame-per-second rate, for good visual results.) 

30
I wanted to see the sky...  :happy: it took me a few hours. Now I can die in peace.
I don't guarantee it's 100% right, but it works. Image size must be 2^n+1. This fractal generator is the base for anything like terrains: you will have to re-map colors to heights of the map/image. Those textures can be mapped later to low-poly surfaces, for fast 3D.
   Limitations: a) how to make images larger than the screen? even with CREATESCREEN() I don't get it. b) MEM2SPRITE() looks fast but a similar function is needed in order to accept directly a 2D array[][], and possibly setup the image size automatically.
   What else? ...  Licence? use and modify at will, but don't sell it without my consent. Credits: please mention my artist's name: F.P. Brixey
   Some post-stretching helps further (see pictures).
Here is a useful reference: http://www.gameprogrammer.com/fractal.html
Now go and be creative! -oh, and share your best groundbreaking images here. Thank you.
CloudGen.gbas:
Code: (glbasic) [Select]
// --------------------------------- //
// Project: CloudGen
// Start: Tuesday, March 17, 2015
// IDE Version: 12.308


// SETCURRENTDIR("Media") // go to media files

CONSTANT N%= 9 //  image size = 2^N
CONSTANT startval=0xf000
CONSTANT damping=0.72277 //high value-> high contrast. lo ->no fine tesseling.
// min. value should be 0.5 i.e. 50%
GLOBAL shift=0.03611 // i.e. % of displacement. Low values produce haze.

GLOBAL s2%=twoPn(N)+1 , xx%=twoPn(N)
GLOBAL im_dat%[]; //DIM im_dat[s2*s2] // 1D only!
GLOBAL tmp%[]   ; DIM tmp[s2][s2];

GLOBAL range%=twoPn(N-1)

//set start values of 4 corners. Subdivide the square later, and reign.
tmp[0 ][0 ]=startval
tmp[0 ][xx]=startval
tmp[xx][0 ]=startval
tmp[xx][xx]=startval

GOSUB fill

GOSUB mem2s

SHOWSCREEN ; MOUSEWAIT ; END ;

fn.gbas:
Code: (glbasic) [Select]
// --------------------------------- //
// Project: CloudGen
// Start: Tuesday, March 17, 2015
// IDE Version: 12.308



FUNCTION twoPn: n%
RETURN ASL(0x1,n)
ENDFUNCTION

FUNCTION setminmax: BYREF a, mi, ma
IF a<mi THEN a=mi
IF a>ma THEN a=ma
ENDFUNCTION

FUNCTION frnd:
?IFDEF PHASE1+
STATIC a=0.41,b
IF RND(1)
b= a*(RND(2000)-1000.0)*0.001
RETURN b
ELSE
RETURN 0.0
ENDIF
?ELSE
RETURN 0.0
?ENDIF
ENDFUNCTION

SUB fill:

// GLOBAL s2%=twoPn(N)+1
// DIM tmp[s2][s2];
// GLOBAL range%=twoPn(N-1) //start value.
// CONSTANT rough=0.5 ; GLOBAL shift=0.4

// Say the output values are 32bits.
// 123
// 456
// 789 Supplied: 1379
//      Goal:    2 456 8

?IF 0
STATIC i%,j%,s5%,ste%
STATIC nb%=1

REPEAT
ste=twoPn(N-nb+1)
ste=twoPn(N-nb+1)
// INC div; ste=(s2-1)/div

FOR i=1 TO nb
FOR j=1 TO nb
setheight(tmp[i*ste][j*ste],tmp[(i+1)*ste][(j+1)*ste]) //5
NEXT; NEXT;

INC nb
UNTIL (N-nb+1)<0
?ENDIF

//////////////////////////////

ini:
LOCAL incr%=twoPn(N), i%, i2%
LOCAL j%,j2% //  xx%=twoPn(N)
LOCAL cnt%=0

REPEAT
i=0
REPEAT
// DEBUG incr ; DEBUG " "
i2=i+incr

j=0
REPEAT
//DEBUG j ; DEBUG "_" ; DEBUG incr ; DEBUG "  ";
j2=j+incr
tmp[(i+i2)*0.5][ j        ]=setheight(tmp[i][j],tmp[i2][j])
tmp[ i        ][(j+j2)*0.5]=setheight(tmp[i][j],tmp[i][j2])

tmp[(i+i2)*0.5][ j2       ]=setheight(tmp[i][j2],tmp[i2][j2])
tmp[ i2       ][(j+j2)*0.5]=setheight(tmp[i2][j],tmp[i2][j2])
IF RND(100)>33 //let's mix the 2
tmp[i+incr*0.5][j+incr*0.5]=setheight(tmp[i][j],tmp[i2][j2]) //produces diagonals.
ELSE
tmp[i+incr*0.5][j+incr*0.5]=setheight(tmp[i+incr*0.5][j],tmp[i+incr*0.5][j2]) //no effect?
ENDIF
j=j2 ; INC j2,incr
UNTIL j2>xx


i=i2 ; INC i2,incr
UNTIL i2>xx
// ASR(incr,1) //  x0.5 ASR not working!!!
incr=incr*0.5
shift=shift*damping

//(debugging safety, sorry) INC cnt; IF cnt>144 THEN END
UNTIL incr < 2
//DEBUG "fill finished.   "
ENDSUB

SUB mem2s:
LOCAL a,col
//DEBUG MEM2SPRITE(......)    --> 1 or 0.
?IF 0 // long method... because 1 dimpush[] per pixel. not good.
//this section is excluded from pgm.
FOR i%=0 TO xx; FOR j%=0 TO xx;
IF tmp[i][j]>startval //0x10000
DIMPUSH im_dat[], 0xff007700//tmp[i][j] //orientation correct?
ELSE
DIMPUSH im_dat[], 0xaaffffff
ENDIF
NEXT; NEXT;

IF MEM2SPRITE(im_dat[],0,s2,s2) THEN DEBUG "MEM2S' is o.k. "// :( Same size! 1D array only!
?ENDIF

//\/\/\/\/\/\/\/\/\/\/\/ faster:



FOR i%=0 TO xx; FOR j%=0 TO xx;

a=((tmp[i][j])/startval +(0.2-1.0))/0.4 -1.0; setminmax(a,-0.99,-0.001)
//ALPHAMODE a/2550
//col=a*RGB(200,5,8) + (1.0-a)*RGB(250,250,250)
ALPHAMODE 0
col=0xbb3333
SETPIXEL i,j, col  //no, use a single DRAWRECT at the start.
ALPHAMODE a
col=0xeeeeee
SETPIXEL i,j, col //

NEXT; NEXT;

//MEM2SPRITE() could be faster, but accepts only 1D arrays.
ENDSUB

FUNCTION setheight: a,b
//STATIC k
//k=RND(3636)
IF RND(1)
//RETURN (a+b)*0.5*(1+shift*100/RND(100)) // wow!
RETURN (a+b)*0.5*(1+shift*(1.0+RND(1)*0.5))
ELSE
RETURN (a+b)*0.5*(1-shift)
ENDIF
// or make up your own law of displacement. Be creative.
ENDFUNCTION

Pages: 1 [2] 3 4 ... 7