Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
52 user(s) are online (39 user(s) are browsing Forums)

Members: 3
Guests: 49

sinisrus, afxgroup, daveyw, more...

Headlines

Forum Index


Board index » All Posts (Daytona675x)




Re: Switch between many amigaos4 machines
Not too shy to talk
Not too shy to talk


Currently I use this one:
TESmart HDMI KVM (8 port, 4k 60Hz support)
Works perfectly with all machines here (X5000, A1222, sam460ex, MOS G4, Aros PC, and std. PCs / Macs).
Current input devices are a Logitech G213 and a Logitech MX Ergo trackball (btw.: I use another MX Ergo to control my two A1200 via Rys MK II, the MX Ergo can switch between two devices on the fly ).

I can not recommend this one and would therefore not recommend any Aten products:
Aten CS1768 (8 port DVI)
- apparently not enough power to support my old Logitech Prodigy. Sometimes it got lost during boot, no lighting, no multimedia key support, etc.
- mouse emulation not working.
- stupid non-configurable hotkeys.
- always dumb OSDs.

In general I can also recommend switches by Uniclass. I had several DVI switches from them (AL-204A, RD1086). They did the job, but all in all I'd go for the TESmart any time again.

Go to top


Re: M.A.C.E. Tower Defense
Not too shy to talk
Not too shy to talk


Let's not forget the most obvious bottleneck:
unoptimized shaders in the game itself.
E.g. I analyzed Spencer shaders and there's huge optimization potential!

Go to top


Re: Dynamite- bomberman clone
Not too shy to talk
Not too shy to talk


@Lio
Quote:
for Atomic Bomberman session you have to log to discord server

No, that's incorrect.
There just happens to be a Discord fan group, much like a FaceBook group or a Whatsapp group chat. People talk there about the game, make suggestions and sometimes date for a match, that's all.
Of course that's in no way mandatory for playing the game.

@VooDoo
Quote:
I just tried ABomber for the first time but it does not work for me. I copied all files from the CD like write in description but I ca not start the game. I do not get any error on start, after I click on icon game I get for 1sec window which close up and that is it..

Looks as if you are trying to run the Warp3D version on a system without a Warp3D-capable gfx card.
Get the latest matching version from here and try again!

https://www.goldencode.de

Go to top


Re: error: lvalue required as increment operand
Not too shy to talk
Not too shy to talk


@rjd324
We cannot be 100% sure what the original purpose was as the code is illegal. Not just because of the casting/++ abuse but also because it guarantees misaligned data accesses which may be a problem depending on the target CPU.

Anyway, apparently the intention is to grab and store chunks of data of different types which are linearly tightly packed into some structure.
And because of lazyness the original coder tried to use the same UBYTE pointers for all different access variants.
It's of course dirty crap. However the old compiler obviously allowed to increase the pointers depending on the type they were casted to, so if it was casted to a temporary UWORD* the ++ operator would increase the original UBYTE* by sizeof(UWORD).

Your
val=*(UWORD*)(chunkbuf++);


has the same semantics as
val=*(UWORD*)(chunkbuf);
++
chunkbuf;


and defeats that purpose as it grabs a UWORD but then increases chunkbuf by sizeof(UBYTE) instead of sizeof(UWORD). So the next access would grab parts of the previously read value...
I strongly doubt that this was the original intention.

@kas1e
Of course my union solution doesn't fix potentially misaligned data access.

Go to top


Re: error: lvalue required as increment operand
Not too shy to talk
Not too shy to talk


@kas1e
OMG, delete all you did
For simplicity you could go with a union like this:

union MixedPointer {
  
UBYTE *ubyte_ptr;
  
UWORD *uword_ptr;
  
ULONG *ulong_ptr;
};

int main()
{    
  
UBYTE *chunkbuf;
  
UBYTE *chunky;
  
UBYTE *chunky2
  
UWORD val;   

  
MixedPointer chunky2_mixed;
  
MixedPointer chunkbuf_mixed;
        
  
chunky2_mixed.ubyte_ptr=chunky2;
  
chunkbuf_mixed.ubyte_ptr=chunkbuf;

  
val=*chunkbuf_mixed.uword_ptr++;
  *
chunky2_mixed.uword_ptr++=val;
  *
chunky2_mixed.ulong_ptr++=*chunkbuf_mixed.ulong_ptr++;
  *
chunky2_mixed.uword_ptr++=*chunkbuf_mixed.uword_ptr++;
}


Untested TM

Go to top


Re: SDL2
Not too shy to talk
Not too shy to talk


Regarding Grim Fandango returning 0 for red, green, blue, alpha bits when using FBO:
if there's no valid color-attachment when querying those infos then you'll get 0. This seems to be the case here because you get the same result on Win32.
However, there was a bug in ogles2.lib which resulted in also returning 0 if there was a valid texture color-attachment (for non-texture attachments it worked correctly). This has been fixed in upcoming ogles2 3.3.

Go to top


Re: Qt 6 progress
Not too shy to talk
Not too shy to talk


@alfkil
I'm currently working on adding proper share-group handling to ogles2.library.
This might be of interest for you and your QT6 project because it should allow sharing of textures etc. among contexts which didn't really work until now.
When I say "should" I actually mean "likely it already does" with the latest wip version 3.3. I guess I'm done but it's not really tested yet

There's a new aglCreateContext2 tag OGLES2_CCT_SHARE_WITH <ogles2-context-pointer>. This optional tag instructs ogles2 to share the same internal Nova-context (with a different render-state-object) and the same set of textures, VBOs, shaders and shader-programs of the given other gl-context.
So you create context 1 and then use its handle with OGLES2_CCT_SHARE_WITH for the creation of another context. The number of sharing contexts is unlimited and you e.g. may destroy context 1 and the resources will still be available for context 2. And the handle of context 2 can of course also be used to create another shared context.

Check it out (if you don't have an account there, contact Matthew to get one):
http://www.amiga.org/developer/bugreports/view.php?id=896

Go to top


Re: Why call to or any "empty" functions cause different results of the other code execution ? FIXED!
Not too shy to talk
Not too shy to talk


@Georg
Yep, you're right and I was blind.
So, no bug in GL4ES, it was a bug / specs violation in ogles2.lib after all.

EDIT:
Updated the lib accordingly. The helper tag has gone again, now the changelog reads like that:

- Fix: specs violation. The IDs returned by glCreateShader and glCreateProgram were independently generated. However, the standard says that the shader IDs' "name space is shared with program objects", a fact which I overread, grrmbl. For an OpenGL ES 2 implementation by itself this violation isn't really a problem but it turned out to be the source for an issue related with GL4ES:
In std. GL, which GL4ES implements based on OGLES2, there's a function glGetObjectParameters which accepts shader- or program-IDs as first parameter. Now due to this bug in ogles2.lib those IDs were not unique, so that this function was not able to distinguish between shader- and program-IDs, which in turn resulted in nonsense behaviour.
Thanks to George for rereading the OGLES2 specs and correcting me on that, as I asumed a bug in GL4ES here.
Now the the IDs returned by glCreateShader and glCreateProgram are unique in the shared UINT32 number space.


Edited by Daytona675x on 2022/3/13 9:41:06
Go to top


Re: Why call to or any "empty" functions cause different results of the other code execution ? FIXED!
Not too shy to talk
Not too shy to talk


EDIT:
It was a specs violation in ogles2 after all, disregard my stuff below, I was wrong.


@kas1e
As I said: there's no word about that in the OpenGL ES 2 specs (unless I'm totally blind). So an implementation may chose whichever ID generation algorithm it may like. There is no rule that shader-IDs and program-IDs are related in any way. Which is logical because there's no critical function like glGetObjectParameters in GLES2.

So it was no bug in ogles2.lib.

It's a bug in GL4ES because it asumes something in its OpenGL ES 2 based implementation which the OpenGL ES 2 standard doesn't guarantee. GL4ES was just lucky so far with those other GLES2 implementations which apparently chose to implement ID generation differently.

To fix GL4ES the following would have to be done:

- glCreateShader and glCreateProgram functions must be wrapped and the IDs returned by the respective ogles2 functions must be mapped to GL4ES-internal shared IDs. Those other IDs must then be returned to the caller.

- in each function which accepts a shader- or program-ID the reverse mapping must be done and then the original ID must be passed to ogles2.

Because it was easy for me to artificially restrict ogles2.lib so that it creates IDs which work with GL4ES, I chose to do so. It also has no performance penalty. Fixing GL4ES is certainly a bit harder than that and would require this extra ID translation.
The bug in GL4ES persists of course, but it doesn't affect the ogles2.lib-code-path anymore so it doesn't matter to us anymore.


Edited by Daytona675x on 2022/3/12 17:40:21
Go to top


Re: Why call to or any "empty" functions can cause different results of the code in which you insert it?
Not too shy to talk
Not too shy to talk


@Capehill
Quote:
We probably need to check OpenGL ES 2.0 specs what is said about program/shader id numbers.

Nothing. ogles2.lib uses dedicated pools which complies to the standard.
But you are right, this is incompatible with GL4ES' glGetObjectParameterARB API. Therefore I modified ogles2.library. From the change-log:

New context creation tag OGLES2_CCT_UNIQUE_SHADER_AND_PROGRAM_IDS.
This is a helper tag to allow APIs like GL4ES' glGetObjectParameterARB to work with ogles2.library.
This API asumes that the shader- and program-IDs generated by glCreateShader and glCreateProgram share the same ID pool. Note that this rule does not apply to OpenGL ES 2 (and not even 3 AFAIK).
When this tag is set to TRUE then ogles2.lib will essentially half the ID-space for shaders and programs and return values from the lower half for programs (ID & 0xFF < 128) and values from the upper half for shaders (ID & 0xFF >= 128).
Note that TRUE has been made the default value for that new tag for convenience. That way GL4ES doesn't have to be rebuild.

Of course I didn't test this at all. A fresh lib build is available at the link which you should have.
If you find this to not work as expected, please file a std. bug report.

Go to top


Re: What the fastest possible x64 emulation way of OS4 today ?
Not too shy to talk
Not too shy to talk


@kas1e
Starting with WinUAE 3.6.1 I got pretty high performance (PicassoIV emulation) and nice overall emulation (prior versions had sound issues for me).
It ran my ported and optimized Tower57 at almost the same fps as the original native x86 version on the same machine, LOL :D
However, Compositing was very slow (maybe that was improved in the meantime).
BGR24 screen-modes were much faster than anything else. Hicolor screen-modes were particularly slow.
Other than that I don't remember any pitfalls.
I still have the UAE config file but unfortunately deleted the virtual HDD so I cannot give it a try with a newer UAE right now.
I'll mail you the config, should be a good starting point.


Go to top


Re: Exodus The Last War patching : work in progress
Not too shy to talk
Not too shy to talk


@salass00
Quote:
you will have to find a free data register

No, Motorola gave us EXG ;)

Quote:
but the programmer did not take into account that moves with an address register as destination do not set condition flags

We can't be sure about that without digging deeper. Maybe he did it on purpose and the BEQ tests the condition before the movea and he wanted to happen the move in any case.
Maybe he just forgot the nullptr check.

@kas1e
That's why this here would be an unintrusive way to add a nullptr check:

MOVEA.L    14(A3),A2        ;10b5c246b000e
BEQ
.W    LAB_0758        ;10b6067000078
    
just insert this 
EXG D0
,A2
TST
.L D0
EXG D0
,A2
BEQ
.W  LAB_0758


You can comment in / out the first BEQ.W. If the behaviour doesn't change for sure then salass00's asumption that the coder falsely asumed that movea changes cc is likely to be correct.

Go to top


Re: Atomic Bomberman Fan Rewrite
Not too shy to talk
Not too shy to talk


@walkero
I don't see this happening happen. The current covid numbers and tendencies, Ireland's as well as Germany's, don't make me optimistic at all. Anyway, I'm of course fully vaccinated and will even be boostered in one week and I'm pro-mask. So if travelling will be allowed I'd be willing to take the risk for myself and others can be pretty sure that I'm no risk for them. That's why subscribed to the notification list for Amiga Ireland and I'll get a ticket if / when they become available. If it get's cancelled it will be a donation at least

@Breed
Have fun

Go to top


Re: Atomic Bomberman Fan Rewrite
Not too shy to talk
Not too shy to talk


Atomic Bomberman Remake received several updates recently. You can find the latest versions on my homepage.


v2.12 (17)
- highly improved player movements mechanics. Walking around corners feels much better now.

- Hockey Rink sliding improved.

- Hockey Rink sliding strength is now adjustable from 0 = no sliding up to 4 = super slippery.

- Hockey Rink now with arrows. Yeah, I totally overlooked for ~ten years that the hockey playfield contains arrows too. Although it's a different arrow layout compared to the Ancient Egypt map.

- data file validation disabled.

- Windows: no glew.dll required anymore.

- Windows: updater was broken due to a compiler bug, thanks again Embarcadero. Their new 64bit compiler produced pure garbage, I couldn't believe my eyes when inspecting the structures during debugging: variables on the heap would just become 0 when returning from a function, stuff like that (and no, the code was valid; actually it was happening inside the good old unzip code).
Solution (unbelievable but true): remove unzip.cpp from the project and include it instead of unzip.h, so it gets compiled in the same unit as the caller


v2.13 (18)
- improved a subtle but significant controls glitch which kicked in if you were pushing horizontally and then added vertical input (or vice versa) in a diagonal fashion and if your movement was blocked in that secondary direction (phew):
then the player would not turn into that "new" direction. This was no problem when it came to regular movement because, well, you were blocked in that direction anyway, after all. BUT:
if you were just punching and wanted to change your direction via diagonal input for the next punch, the player wouldn't turn and the next punch would go to the previous direction... Therefore punch-escaping situations in which you were surrounded by bombs didn't work well, if you used diagonal input.
Similar problem when you were holding a bomb in such a blocked situation: diagonal movement wouldn't make you turn, so you'd probably accidentially throw the bomb in an unwanted direction.

- the above required a remedy in combination with transport bands and sliding. Otherwise the animation for the "original" input direction would play for one frame again after the direction-correction kicked in

- Fix: no idea how this one slipped inside (had nothing to do with the above changes at all): when you carried a bomb you'd eventually just drop another


v2.14 (19)
- Fix: network protocol wasn't extended to transfer the new hockey rink slide option, which could cause clients to get out of sync.


v2.15 (20)
- Networking: scheme files (maps) are now transmitted from the server to the clients. So if the server has modified or additional scheme files, those will work now without manually installing and syncing those files among all clients beforehand.

- Fix: it was possible to cancel / skip the initial setup screen by pushing ESC or equivalent buttons... Of course with pretty fatal consequences later on. Thanks to gpsoft for reporting.

- Cosmetic fix: during presentation mode (auto cycling through menus and intro if input idle) the music stopped when auto-entering the extras description screen.


@samo79
Before you ask: no, I still didn't find the cause of this problem.

Tchatching,
Daniel

Go to top


Re: The OpenGL ES 2.0 thread
Not too shy to talk
Not too shy to talk


@kas1e
Quote:
Probably that need to be handled/redirected via ogles2 too then ?

If Nova supports it then there is nothing to do inside ogles2.lib. A correct #version should be enough.

Go to top


Re: The OpenGL ES 2.0 thread
Not too shy to talk
Not too shy to talk


@kas1e
In general: you cannot really mimic gl_VertexID unless you manually setup an extra vertex attribute and fill it with your own IDs.

Other than that you cannot really rewrite that shader here without a gl_VertexID equivalent and expect it to produce something anywhere near the originally desired output. Unfortunately there's no other shader input that seems to be appropriate to derive the missing info.

Go to top


Re: OS4 UPDAAAATEE !!! BANANA !!
Not too shy to talk
Not too shy to talk


Great stuff and a big "eat that" to all the nay-sayers and those oh-so-well informed people who repeatedly claimed that there was no activity
Thanks to all involved!

Go to top


Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


@Capehill
Quote:
y flipping in FBO cases because otherwise FBO textures are upside down for the reasons I don't know

That's because the first FB pixel is at the bottom-left, much in contrast to most textures that come from files where the first pixel is at the top-left.

@kas1e
Quote:
Btw, is it expected, that when I set for textures "VFLIP texture vertically", then for some shaders rendering starts to be visibly slower.

And for others it will become visibly faster
That's because some such textures' values are not meant to be interpreted as pure colors but are actually texture-encoded input parameters to the shader's logic and thus may influence its runtime.


Edited by Daytona675x on 2020/12/22 9:51:58
Go to top


Re: The OpenGL ES 2.0 thread
Not too shy to talk
Not too shy to talk


@Capehill
Most likely you got confused with your UVs somewhere. It's a very common mistake when it comes to FBOs being used as textures. Although I have to admit that I'm not immune to such confusion and to be honest:
the primary reason why I think that you and not I got confused here is that IIRC Entwickler-X used FBO textures for cross-platform projects already and I heard no complains
In short: yes, usually you'd use flipped Vs for FBO-textures (where the first pixel is bottom-left) compared to lets-call-it file-textures (where the first texel is usually top-left in memory).

Therefore: please doublecheck your code (if possible run the critical stuff on a non-Amiga machine). If you still think that there's an issue then please upload test-code / exe to my FTP.


Edited by Daytona675x on 2020/12/22 9:31:01
Go to top


Re: Shaderjoy 1.17
Not too shy to talk
Not too shy to talk


@Capehill
I didn't find a concrete documentation but I find the format rather self-explaining.
If you have an account at ShaderToy you can easily download the JSON for a specific shader that way:

- login
- go to your apps, create one if you didnt yet and then grab the App Key
- browse to a nice simple shader for a start, e.g. this one
- in the URL you'll find the shader's ID, in this case Xt2XzW
- use that ID and your key to fill out this URL:
https://www.shadertoy.com/api/v1/shaders/ID?key=KEY

There you go:
{
    
"Shader": {
        
"ver""0.1",
        
"info": {
            
"id""Xt2XzW",
            
"date""1442017330",
            
"viewed"5769,
            
"name""Beenox goes BlackOps 3",
            
"username""fungos",
            
"description""my first shader toying, had nothing to do and wanted to try distance fields. still need improve this a lot, mostly  reflection and bo3 logo material (maybe some fire), suggestions? :)\n\nSome machines can't compile the shader, help someone?",
            
"likes"15,
            
"published"3,
            
"flags"0,
            
"usePreview"0,
            
"tags": [
                
"logo",
                
"distance",
                
"geometry",
                
"beenox",
                
"blackops3",
                
"cod"
            
],
            
"hasliked"0
        
},
        
"renderpass": [
            {
                
"inputs": [
                ],
                
"outputs": [
                ],
                
"code""#define A 3.545\n#define B 1.15\n#define M smoothstep\n\n\/\/ rotate on axis Z\nvec3 Z(vec3 v, float a)\n{\n    vec3 vo = v; float c = cos(a); float s = sin(a);\n    v.x = c * vo.x - s * vo.y;\n    v.y = s * vo.x + c * vo.y;\n    return v;\n}\n\n\/\/ Rotate on axis Y\nvec3 Y(vec3 v, float a)\n{\n    vec3 vo = v; float c = cos(a); float s = sin(a);\n    v.x = c * vo.x - s * vo.z;\n    v.z = s * vo.x + c * vo.z;\n    return v;\n}\n\n\/\/ Torus82\nfloat T(vec3 p, vec2 t)\n{\n    vec2 q = vec2(sqrt(p.x * p.x + p.y * p.y) - t.x, p.z);\n    q = q*q; q = q*q; q = q*q;\n    return pow(q.x + q.y, 1. \/ 8.) - t.y;\n}\n\n\/\/ Gear\nfloat G(vec3 p, float a, float r)\n{\n    float d = 1.;\n    for (int i = 0; i < 6; i++)\n    {\n        vec3 q = abs(Z(p, a) - vec3(.0, r + .25, .0));\n        d = min(d, max(q.z - .3, max((q.x * .6 + q.y * .7), q.y) - .25));\n        a += 1.03;\n    }\n    \n    return max(-d, T(p, vec2(r, .1)));\n}\n\n\/\/ sdBox\nfloat X(vec3 p, vec3 b)\n{\n    vec3 d = abs(p) - b;\n    return min(max(d.x, max(d.y, d.z)), .0) + length(max(d, .0));\n}\n\n\/\/ sdHexPrism\nfloat H(vec3 p, vec2 h)\n{\n    vec3 q = abs(p);\n    return max(q.z - h.y, max((q.x + q.y * .3), q.y) - h.x);\n}\n\n\/\/ smin\nfloat S(float a, float b, float k)\n{\n    float h = clamp(.5 + .5 * (b - a) \/ k, 0., 1.);\n    return mix(b, a, h) - k * h * (1. - h);\n}\n\n\/\/ Beenox\nfloat BX(float t, vec3 p, float f)\n{\n    float s = t*t;\n    if (t > A) s \/= 2.;\n    p = Y(p, s);\n    \n    float a = G(p, .6, f * .5);\n    float b = length(p) - f * .33;\n    return min(b, a);\n}\n\n\/\/ Black Ops 3\nfloat BO(vec3 p, float x, float t)\n{\n    vec2 z = vec2(.12, .15);\n    vec3 w = vec3(.12, z);\n    \n    \/\/ 1\n    float a = X(p - vec3(x, .0, .0), vec3(.14, .6, .15));\n    float b = X(p - vec3(x + .1, .48, .0), w);\n    float c = H(Z(p - vec3(x + .065, .32,  .0), .8), z);\n    float d = X(p - vec3(x + .1, -.49, .0), vec3(.12, .11, .15));\n    float e = H(Z(p - vec3(x + .065, -.335, .0), -.75), z);\n    a = min(a, min(e, min(d, min(c, b))));\n\n    \/\/ 2\n    c = mix(.0, .15, M(0., 4.5, t));\n    d = mix(.0, .2, M(.7, .8, t));\n    b = X(p - vec3(.0, .0, .0), vec3(d, .6, c));\n\n    \/\/ 3\n    c = X(p - vec3(-x, .0, .0), vec3(.13, .6, .15));\n    d = X(p - vec3(-x - .1, .48, .0), w);\n    e = H(Z(p - vec3(-x - .065, .32, .0), -.8), z);\n    float f = X(p - vec3(-x - .1,-.48, .0), vec3(.12, .12, .15));\n    float g = H(Z(p - vec3(-x - .065, -.335, .0), .75), z);\n    c = min(c, min(g, min(f, min(e, d))));\n    \n    return min(c, min(b, a));\n}\n\nfloat map(float t, vec3 p)\n{\n    float x = 0.;\n    float y = 0.;\n\tfloat d = 0.;\n    if (t < A + B)\n\t{\n        d = BX(t, p, 1.);\n\t}\n    else if (t < 5.)\n\t{\n        d = BX(A + B, p, 1.);\n\t}\n    else if (t < 7.)\n    {\n        x = BX(A + B, p, M(1.1, 0., t - 5.));\n        y = X(p, vec3(.15, .6 * M(0., 1., t - 5. + .4), .15));\n        d = S(y, x, .1);\n    }\n    else\n    {\n        t -= 7.;\n        x = .2 * pow(M(.0, 1., t), .5);\n        y = .25 * pow(M(1.2, 3., t), .5);\n        d = BO(p, x + y, t);\n    }\n\treturn d;\n}\n\n\/\/ plane - intersection with a predefined plane\nvec3 P(vec3 p, vec3 d) \n{\n    vec3 n = vec3(0., 1., 0.);\n    float f = dot(-n * .8 - p, n) \/ dot(n, d);\n    return p + d * f;\n}\n\n\/\/ Material used for the infinite plane\nvec2 MAT(vec2 uv)\n{\n    vec2 uv2 = mod(uv, vec2(2.)) - mod(uv, vec2(1.));\n    float d = uv2.x + uv2.y; \n    d = pow(d - 1., 2.) * .4;\n    \n    float s = d;\n    d += s * .2;\n\n    \/\/d - diffuse, s - specular\n    return vec2(d, s * s * .5 + .1);\n}\n\n\/\/ render background layer used for reflection\nvec3 BG(vec3 p, vec3 d, vec3 l)\n{\n    \/\/ plane normal\n    vec3 n = vec3(0., 1., 0.);\n    \n    \/\/ diffuse lighting for the plane\n    float df = dot(n, l) * .5 + .5; \n    \n    \/\/ to blend the plane with the sky\n    float a = max(0., dot(d, -n)); \/\/ alpha - this coefficient is used\n    \n    \/\/ get the floor material\n    vec2 m = MAT(P(p, d).xz); \/\/ x = diffuse coefficient, y = specular coefficient\n    \n    \/\/ atmosphere\n    vec3 at = vec3(.3, .4, .7) * (1. - abs(d.y)) * 1.5;\n\n    \/\/ calculate the planes color\n    vec3 c = m.x * vec3(.4) * df + (m.y * .7) * (at * .2);\n    \n    \/\/ reduce fog\n    a = pow(a, .4);\n    \n    \/\/ mix the plane with the sky\n    return mix(at, c, a);\n}\n\n\/\/ Normal\nvec3 N(float t, vec3 p, float e)\n{\n\tfloat d = map(t, p);\n\treturn normalize(\n        vec3(\n            map(t, p + vec3(e, 0, 0)) - d,\n            map(t, p + vec3(0, e, 0)) - d,\n            map(t, p + vec3(0, 0, e)) - d\n        )\n    );\n}\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n    float t = 0.;\n    if (iResolution.x <= 400.0) t = mod(iTime - 6.455, 15.);\n    else t = mod(iTime, 15.);\n    vec2 uv = fragCoord.xy \/ iResolution.xy - .5;\n    uv.x *= iResolution.x \/ iResolution.y; \/\/fix aspect ratio\n    if (iResolution.y < 200.0) t = A;\n    \n    \/\/ ray position\n    vec3 p = vec3(0., 0., 2.1); \n    \n    \/\/ ray direction\n    vec3 d = normalize(Y(vec3(uv, 1.), 3.14159));\n    \n    \/\/ light\n    vec3 l = vec3(-.5, 1.2, .5);\n    \n    \/\/ background\n    \/\/vec3 c = vec3(0.);\n    vec3 c = BG(p, d, l);\n\n    \/\/ raymarching\n    float di = 0.;\n    for (int i = 0; i < 75; i++)\n    {\n        \/\/ scene\n        di = map(t, p);\n        p += d * di * .4;\n\n        \/\/ too far away from the object or close enough, stop\n        if (di > 5. || di < .03) \n            break;\n    }\n\n    if (di < .03)\n    {\n        vec3 n = N(t, p, .002);\n\n        \/\/ a bit more wierd diffuse lighting, but looks great\n        float diffuse = dot(l, n) * .1 + .5;\n        diffuse = pow(diffuse, 1.5);\n\n        \/\/ object color\n        c = mix(vec3(.4, .4, 1.4), vec3(.1), M(B, 7., t));\n\n        \/\/ reflection\n        c = mix(c * diffuse, BG(p, reflect(d, n), l), (1.0 + dot(d, n)) * .6 + .2);\n\n        \/\/ self occlusion\n        c *= map(t, p + n) * .5 + .5;\n    }    \n    \n    \/\/ fade in\n    c = mix(c, vec3(0.), M(3., 0., t));\n\n    \/\/ fade out\n    c = mix(c, vec3(0.), M(14., 15., t)); \n    \n    fragColor = vec4(c, 1.);\n}",
                
"name""Image",
                
"description""",
                
"type""image"
            
}
        ]
    }
}


This should give you a good idea on the most important format details already. From there either take a look at shaders with more inputs etc. or play around with your own shader project.

@kas1e
Quote:
All the time i look at json config files, it looks like html mess. Lots of tags, tabs and crap.

That sounds as if you were looking at xml and not json.
json can be almost as compact as an ini txt file, in fact, if you want, you can easily mimic that like
{
    
"ini-field1""bla",
    
"ini-field2""blurp",
    
"ini-field3""blorp"
}

Apart from the " I see no bloat or less readability compared to an ini file equivalent. Tabs and stuff are purely optional, of course.
But if you want you get objects, arrays, some standard types, etc. in a compact, easy to read and most of all standardized way.

I use JSON for some years now for almost all my "I need some data / config / whatever" files. And I never looked back.

Go to top



TopTop
(1) 2 3 4 ... 23 »




Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project