-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
274 changed files
with
1,084 additions
and
1,045 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 46 additions & 46 deletions
92
src/ops/base/Ops.Deprecated.Gl.Meshes.RandomPoints/Ops.Deprecated.Gl.Meshes.RandomPoints.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,87 @@ | ||
|
||
const exe=op.inTrigger("exe"); | ||
var num=op.addInPort(new CABLES.Port(op,"num")); | ||
var size=op.addInPort(new CABLES.Port(op,"size"),CABLES.OP_PORT_TYPE_VALUE); | ||
var seed=op.addInPort(new CABLES.Port(op,"random seed")); | ||
var scaleX=op.addInPort(new CABLES.Port(op,"scaleX",CABLES.OP_PORT_TYPE_VALUE,{ display:'range' })); | ||
var scaleY=op.addInPort(new CABLES.Port(op,"scaleY",CABLES.OP_PORT_TYPE_VALUE,{ display:'range' })); | ||
var scaleZ=op.addInPort(new CABLES.Port(op,"scaleZ",CABLES.OP_PORT_TYPE_VALUE,{ display:'range' })); | ||
const exe = op.inTrigger("exe"); | ||
let num = op.addInPort(new CABLES.Port(op, "num")); | ||
let size = op.addInPort(new CABLES.Port(op, "size"), CABLES.OP_PORT_TYPE_VALUE); | ||
let seed = op.addInPort(new CABLES.Port(op, "random seed")); | ||
let scaleX = op.addInPort(new CABLES.Port(op, "scaleX", CABLES.OP_PORT_TYPE_VALUE, { "display": "range" })); | ||
let scaleY = op.addInPort(new CABLES.Port(op, "scaleY", CABLES.OP_PORT_TYPE_VALUE, { "display": "range" })); | ||
let scaleZ = op.addInPort(new CABLES.Port(op, "scaleZ", CABLES.OP_PORT_TYPE_VALUE, { "display": "range" })); | ||
// var round=op.inValueBool('round',false); | ||
|
||
var cgl=op.patch.cgl; | ||
let cgl = op.patch.cgl; | ||
|
||
scaleX.set(1); | ||
scaleY.set(1); | ||
scaleZ.set(1); | ||
|
||
function doRender() | ||
{ | ||
if(mesh) | ||
if (mesh) | ||
{ | ||
mesh.render(cgl.getShader()); | ||
|
||
if (cgl.shouldDrawHelpers(op)) | ||
{ | ||
CABLES.GL_MARKER.drawCube(op, | ||
size.get()/2*scaleX.get(), | ||
size.get()/2*scaleY.get(), | ||
size.get()/2*scaleZ.get()); | ||
size.get() / 2 * scaleX.get(), | ||
size.get() / 2 * scaleY.get(), | ||
size.get() / 2 * scaleZ.get()); | ||
} | ||
} | ||
} | ||
|
||
exe.onTriggered=doRender; | ||
exe.onTriggered = doRender; | ||
|
||
var mesh=null; | ||
var geom=null; | ||
var mesh = null; | ||
let geom = null; | ||
|
||
function reset() | ||
{ | ||
geom=new CGL.Geometry(); | ||
var verts=[]; | ||
var n=Math.round(num.get())||1; | ||
if(n<0)n=1; | ||
var texCoords=[]; | ||
var vertColors=[]; | ||
verts.length=n*3; | ||
texCoords.length=n*2; | ||
vertColors.length=n*3; | ||
geom = new CGL.Geometry(); | ||
let verts = []; | ||
let n = Math.round(num.get()) || 1; | ||
if (n < 0)n = 1; | ||
let texCoords = []; | ||
let vertColors = []; | ||
verts.length = n * 3; | ||
texCoords.length = n * 2; | ||
vertColors.length = n * 3; | ||
|
||
Math.randomSeed=seed.get()+0.01; | ||
Math.randomSeed = seed.get() + 0.01; | ||
|
||
var sizeMul=size.get(); | ||
let sizeMul = size.get(); | ||
|
||
for(var i=0;i<num.get();i++) | ||
for (let i = 0; i < num.get(); i++) | ||
{ | ||
verts[i*3+0]=scaleX.get()*(Math.seededRandom()-0.5)*sizeMul; | ||
verts[i*3+1]=scaleY.get()*(Math.seededRandom()-0.5)*sizeMul; | ||
verts[i*3+2]=scaleZ.get()*(Math.seededRandom()-0.5)*sizeMul; | ||
verts[i * 3 + 0] = scaleX.get() * (Math.seededRandom() - 0.5) * sizeMul; | ||
verts[i * 3 + 1] = scaleY.get() * (Math.seededRandom() - 0.5) * sizeMul; | ||
verts[i * 3 + 2] = scaleZ.get() * (Math.seededRandom() - 0.5) * sizeMul; | ||
|
||
vertColors[i*3+0]=Math.seededRandom(); | ||
vertColors[i*3+1]=Math.seededRandom(); | ||
vertColors[i*3+2]=Math.seededRandom(); | ||
vertColors[i * 3 + 0] = Math.seededRandom(); | ||
vertColors[i * 3 + 1] = Math.seededRandom(); | ||
vertColors[i * 3 + 2] = Math.seededRandom(); | ||
|
||
texCoords[i*2]=Math.seededRandom(); | ||
texCoords[i*2+1]=Math.seededRandom(); | ||
texCoords[i * 2] = Math.seededRandom(); | ||
texCoords[i * 2 + 1] = Math.seededRandom(); | ||
} | ||
|
||
geom.setPointVertices(verts); | ||
geom.vertColors=vertColors; | ||
geom.texCoords=texCoords; | ||
geom.vertColors = vertColors; | ||
geom.texCoords = texCoords; | ||
|
||
if(mesh)mesh.dispose(); | ||
mesh =new CGL.Mesh(cgl,geom,cgl.gl.POINTS); | ||
mesh.addVertexNumbers=true; | ||
if (mesh)mesh.dispose(); | ||
mesh = new CGL.Mesh(cgl, geom, { "glPrimitive": cgl.gl.POINTS }); | ||
mesh.addVertexNumbers = true; | ||
mesh.setGeom(geom); | ||
} | ||
|
||
size.set(5); | ||
seed.set(0); | ||
seed.onChange=reset; | ||
num.onChange=reset; | ||
size.onChange=reset; | ||
scaleX.onChange=reset; | ||
scaleZ.onChange=reset; | ||
scaleY.onChange=reset; | ||
seed.onChange = reset; | ||
num.onChange = reset; | ||
size.onChange = reset; | ||
scaleX.onChange = reset; | ||
scaleZ.onChange = reset; | ||
scaleY.onChange = reset; | ||
|
||
num.set(1000); |
Oops, something went wrong.