Three.js: Rawshader example - wrong variable naming and value.

Created on 27 Jul 2019  路  3Comments  路  Source: mrdoob/three.js

Hey,

Was looking into the rawshader example it's a bit confusing because there is a variable called triangles which make you think that this will be the number of triangles on screen while it's actually just the number of vertices. Also the number 500 is strange because the vertices need to be a multiplier of 3.

https://github.com/mrdoob/three.js/blob/fa1768032860a003835a821155c0ab14c83f173b/examples/webgl_buffergeometry_rawshader.html#L85

Greets
Kris

Bug Examples

All 3 comments

Introduced in 749353837a7eccea18a35f34ff78ff8a0abce32f which went from

for ( var i = 0, l = triangles * 3 * 3; i < l; i += 3 ) {

to

for ( var i = 0; i < triangles; i ++ ) {

For comparison:
old 05d67cc5b9b98e66c10ba8461a805b46af49f854
new 749353837a7eccea18a35f34ff78ff8a0abce32f

You are right, that's confusing. I would rename triangles to just vertexCount and set it to 600.

@lab101 Do you want to make the PR with the change?

okay will make a PR later this weekend.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

konijn picture konijn  路  3Comments

Bandit picture Bandit  路  3Comments

zsitro picture zsitro  路  3Comments

Horray picture Horray  路  3Comments

jack-jun picture jack-jun  路  3Comments