| Blockland Forums > Suggestions & Requests |
| Brick terrain generation by simplex noise |
| << < (2/3) > >> |
| Port:
more like simplex noise |
| Axolotl:
help me I goofed up on it hard --- Code: ---function cubicInterpolate1D(%pa,%pb,%pc,%pd,%x) //generate a cubic curve by Catmull-Rom spline { %ax3 = ((-0.5 * %pa) + (1.5 * %pb) + (-1.5 * %pc) + (0.5 * %pd)) * mPow(%x, 3); //generate ax3 %bx2 = (%pa + (-2.5 * %pb) + (2 * %pc) + (-0.5 * %pd)) * mPow(%x, 2); //generate bx2 %cx = ((-0.5 * %pa) + (0.5 * %pc) * %x); //generate cx return %ax3 + %bx2 + %cx + %pa; } function serverCmdCreateCubicCurve(%cl,%pa,%pb,%pc,%pd,%scale) { for(%i = 0; %i <= %scale * 4; %i++) { %brick = new fxDTSBrick() { dataBlock = "brick4xCubeData"; position = 0 SPC %i * 2 SPC cubicInterpolate1D(%pa,%pb,%pc,%pd,%i / %scale); stackBL_ID = %cl.bl_id; }; echo(%brick); %brick.plant(); } } --- End code --- --- Quote from: Port on July 24, 2012, 07:46:28 PM ---more like simplex noise --- End quote --- what a brilliant idea, but you do it :c |
| otto-san:
can you even have datablock names as strings? |
| Axolotl:
--- Quote from: otto-san on July 24, 2012, 08:09:34 PM ---can you even have datablock names as strings? --- End quote --- Dumping a brick returns a stringed datablock |
| Port:
--- Quote from: otto-san on July 24, 2012, 08:09:34 PM ---can you even have datablock names as strings? --- End quote --- ... you can have anything as a string if there is an object with the ID 1000 and the name Donut ==>echo( isObject( "Donut" ) ); 1 ==>echo( isObject( "1000" ) ); 1 and datablocks are just regular objects you can even use setName on them |
| Navigation |
| Message Index |
| Next page |
| Previous page |