Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32738 > unrolled thread

3d, twisted potential field. Half assed dna look about it...

Started by"Chris M. Thomasson" <invalid@invalid.invalid>
First post2017-03-11 23:03 -0800
Last post2017-03-12 08:32 -0700
Articles 7 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  3d, twisted potential field. Half assed dna look about it... "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-03-11 23:03 -0800
    Re: 3d, twisted potential field. Half assed dna look about it... jonas.thornvall@gmail.com - 2017-03-12 06:07 -0700
    Re: 3d, twisted potential field. Half assed dna look about it... jonas.thornvall@gmail.com - 2017-03-12 06:10 -0700
    Re: 3d, twisted potential field. Half assed dna look about it... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-03-12 08:10 -0700
      Re: 3d, twisted potential field. Half assed dna look about it... "Chris M. Thomasson" <invalid@invalid.invalid> - 2017-03-13 13:25 -0700
        Re: 3d, twisted potential field. Half assed dna look about it... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-03-13 17:36 -0700
    Re: 3d, twisted potential field. Half assed dna look about it... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-03-12 08:32 -0700

#32738 — 3d, twisted potential field. Half assed dna look about it...

From"Chris M. Thomasson" <invalid@invalid.invalid>
Date2017-03-11 23:03 -0800
Subject3d, twisted potential field. Half assed dna look about it...
Message-ID<oa2rn3$j4k$1@dont-email.me>
Here is the experimental online WebGL example:

http://funwithfractals.atspace.cc/ct_gfield_test/3d_user/ct_wormhole_exp.html

And here is a screen shot:

https://plus.google.com/101799841244447089430/posts/DdbzQyZFeA2

Any thoughts? This should get better FPS than some of my other animations...

;^o


Fwiw, check this one out as well:

http://funwithfractals.atspace.cc/ct_gfield_test/3d_user
;^)

[toc] | [next] | [standalone]


#32742

Fromjonas.thornvall@gmail.com
Date2017-03-12 06:07 -0700
Message-ID<dbff44ba-af02-42d7-b1a3-080d08974e93@googlegroups.com>
In reply to#32738
Den söndag 12 mars 2017 kl. 08:03:46 UTC+1 skrev Chris M. Thomasson:
> Here is the experimental online WebGL example:
> 
> http://funwithfractals.atspace.cc/ct_gfield_test/3d_user/ct_wormhole_exp.html
> 
> And here is a screen shot:
> 
> https://plus.google.com/101799841244447089430/posts/DdbzQyZFeA2
> 
> Any thoughts? This should get better FPS than some of my other animations...
> 
> ;^o
> 
> 
> Fwiw, check this one out as well:
> 
> http://funwithfractals.atspace.cc/ct_gfield_test/3d_user
> ;^)

Can you show the FPS?

[toc] | [prev] | [next] | [standalone]


#32743

Fromjonas.thornvall@gmail.com
Date2017-03-12 06:10 -0700
Message-ID<2b88f8f5-2e1b-4356-9b44-c71c74329bf5@googlegroups.com>
In reply to#32738
Den söndag 12 mars 2017 kl. 08:03:46 UTC+1 skrev Chris M. Thomasson:
> Here is the experimental online WebGL example:
> 
> http://funwithfractals.atspace.cc/ct_gfield_test/3d_user/ct_wormhole_exp.html
> 
> And here is a screen shot:
> 
> https://plus.google.com/101799841244447089430/posts/DdbzQyZFeA2
> 
> Any thoughts? This should get better FPS than some of my other animations...
> 
> ;^o
> 
> 
> Fwiw, check this one out as well:
> 
> http://funwithfractals.atspace.cc/ct_gfield_test/3d_user
> ;^)

I understand you use an API webGL, but i would like to ask you about clipping using javscript Canvas clip objects outside canvas automatically or must the programmer do it manually?

[toc] | [prev] | [next] | [standalone]


#32744

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-03-12 08:10 -0700
Message-ID<9aa42ae6-8c59-4bce-b9e8-c4b2616844f0@googlegroups.com>
In reply to#32738
On Sunday, March 12, 2017 at 1:03:46 AM UTC-6, Chris M. Thomasson wrote:
> Here is the experimental online WebGL example:
> [...]
> Any thoughts? This should get better FPS than some of my other animations...

FYI, Array.prototype.push(...) can take multiple arguments

So the following:

a.push(v[0]);
a.push(v[1]);
a.push(v[2]);
a.push(v[3]);

can become:

a.push(v[0], v[1], v[2], v[3])

or even:

a.push.apply(a,v)

or with a modern browser:

a.push(...v)

[toc] | [prev] | [next] | [standalone]


#32747

From"Chris M. Thomasson" <invalid@invalid.invalid>
Date2017-03-13 13:25 -0700
Message-ID<oa6v2u$hvk$1@dont-email.me>
In reply to#32744
On 3/12/2017 8:10 AM, Michael Haufe (TNO) wrote:
> On Sunday, March 12, 2017 at 1:03:46 AM UTC-6, Chris M. Thomasson wrote:
>> Here is the experimental online WebGL example:
>> [...]
>> Any thoughts? This should get better FPS than some of my other animations...
>
> FYI, Array.prototype.push(...) can take multiple arguments
>
> So the following:
>
> a.push(v[0]);
> a.push(v[1]);
> a.push(v[2]);
> a.push(v[3]);
>
> can become:
>
> a.push(v[0], v[1], v[2], v[3])
>
> or even:
>
> a.push.apply(a,v)
>
> or with a modern browser:
>
> a.push(...v)
>

Ummm, I did not really know about that aspect of the Array push 
function; thank you Michael. Anybody that reads my JavaScript code, sort 
of knows that I am _not_ an experienced native in the language. I love 
to use arrays and C style, but the former can really ruin performance 
wrt, ummm, say... GC?

;^)

[toc] | [prev] | [next] | [standalone]


#32749

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-03-13 17:36 -0700
Message-ID<36a09aea-84c8-401a-80d9-75bad1de688c@googlegroups.com>
In reply to#32747
Chris M. Thomasson wrote:
>
> Ummm, I did not really know about that aspect of the Array push 
> function; thank you Michael. Anybody that reads my JavaScript code, sort 
> of knows that I am _not_ an experienced native in the language. I love 
> to use arrays and C style, but the former can really ruin performance 
> wrt, ummm, say... GC?

I suspect and expect the latter forms to be more efficient due to far fewer dispatches. GC shouldn't matter with either. 

[toc] | [prev] | [next] | [standalone]


#32745

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-03-12 08:32 -0700
Message-ID<0d3a8af8-e622-4ff6-bc8c-feb6f0217335@googlegroups.com>
In reply to#32738
On Sunday, March 12, 2017 at 1:03:46 AM UTC-6, Chris M. Thomasson wrote:
> Here is the experimental online WebGL example:
> [...]
> Any thoughts? This should get better FPS than some of my other animations...

Also, if you're using WebGL, it's safe to assume you don't need the requestAnimationFrame polyfill. You drop that entire function. [1]

Array.fill() also exists [2] now which you might find useful: 

var vertices_colors = Array(4 * 8).fill(1.0)

...

the Float32Array constructor accepts an array, so you can refactor:

var verts = new Float32Array(24);

verts[0] = -1.0; verts[1] = -1.0; verts[2] = 1.0;
verts[3] = 1.0; verts[4] = -1.0; verts[5] = 1.0;
verts[6] = 1.0; verts[7] = 1.0; verts[8] = 1.0;
verts[9] = -1.0; verts[10] = 1.0; verts[11] = 1.0;
verts[12] = 1.0; verts[13] = -1.0; verts[14] = -1.0;
verts[15] = -1.0; verts[16] = -1.0; verts[17] = -1.0;
verts[18] = -1.0; verts[19] = 1.0; verts[20] = -1.0;
verts[21] = 1.0; verts[22] = 1.0; verts[23] = -1.0;

to:

var verts = new Float32Array([
    -1.0,-1.0, 1.0,
     1.0,-1.0, 1.0,
     1.0, 1.0, 1.0,
    -1.0, 1.0, 1.0,
     1.0,-1.0,-1.0,
    -1.0,-1.0,-1.0,
    -1.0, 1.0,-1.0,
     1.0, 1.0,-1.0
]);

[1] <http://caniuse.com/#feat=requestanimationframe>
[2] <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web