how idea will be implemented - getting all points on line in array, use them as limits for "tufts" used in code on github.
it would be cool if I could draw some line in code up in the article and use the array of drawn points to limit positions of tufts.
<!DOCTYPE html>
<script src='vendor/three.js/build/three.min.js'></script>
<script src='../threex.grass.js'></script>
<body style='margin: 0px; overflow: hidden;'><script>
var renderer = new THREE.WebGLRenderer({
antialias : true
});
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor( 'lightblue', 1 );
document.body.appendChild( renderer.domElement );
var onRenderFcts= [];
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(20, window.innerWidth / window.innerHeight, 0.01, 100);
camera.position.z = 1;
camera.position.set(0, 1000, 0);
setInterval(function (){
//console.log("x", camera.position.x);
//console.log("y", camera.position.y);
//console.log("z", camera.position.z);
camera.position.set(0, 50, 0);
}, 300);
//////////////////////////////////////////////////////////////////////////////////
// set 3 point lighting //
//////////////////////////////////////////////////////////////////////////////////
;(function(){
// add a ambient light
var light = new THREE.AmbientLight( 0x020202 )
scene.add( light )
// add a light in front
var light = new THREE.DirectionalLight('white', 1)
light.position.set(0.5, 0.5, 2)
scene.add( light )
// add a light behind
var light = new THREE.DirectionalLight('white', 0.75)
light.position.set(-0.5, -0.5, -2)
scene.add( light )
})()
//// add a light behind
//var light = new THREE.DirectionalLight('white', 1)
//// var light = new THREE.PointLight('white', 2)
//scene.add( light )
//light.position.y= 1
//onRenderFcts.push(function(delta, now){
//var angle = now*Math.PI*2 * 0.2
//light.position.x= Math.cos(angle)*3
//light.position.y= Math.sin(angle)*3
//// light.position.z= Math.sin(angle)*3
//})
////////////////////////////////////////////////////////////////////////////////////
//// grass ground šito vajag figūrveidā //
////////////////////////////////////////////////////////////////////////////////////
//var textureUrl = 'images/grasslight-small.jpg'
//var texture = THREE.ImageUtils.loadTexture(textureUrl);
//texture.wrapS = THREE.RepeatWrapping;
//texture.wrapT = THREE.RepeatWrapping;
//texture.repeat.x= 10
//texture.repeat.y= 10
//texture.anisotropy = renderer.getMaxAnisotropy()
//// build object3d
//var geometry = new THREE.PlaneGeometry(20, 20)
//var material = new THREE.MeshPhongMaterial({
//map : texture,
//emissive: 'green',
//})
//var object3d = new THREE.Mesh(geometry, material)
//object3d.rotateX(-Math.PI/2)
//scene.add(object3d)
////////////////////////////////////////////////////////////////////////////////////
//// comment //
////////////////////////////////////////////////////////////////////////////////////
//var nTufts = 15000
//var positions = new Array(nTufts)
//for(var i = 0; i < nTufts; i++){
//var position = new THREE.Vector3()
//position.x = (Math.random()-0.5)*20
//position.z = (Math.random()-0.5)*20
//positions[i] = position
//}
//var mesh = THREEx.createGrassTufts(positions)
//scene.add(mesh)
//// load the texture
//var textureUrl = THREEx.createGrassTufts.baseUrl+'images/grass01.png'
//var material = mesh.material
//material.map = THREE.ImageUtils.loadTexture(textureUrl)
//material.alphaTest = 0.7
////////////////////////////////////////////////////////////////////////////////////
//// comment //
////////////////////////////////////////////////////////////////////////////////////
//var nTufts = 5000
//var positions = new Array(nTufts)
//for(var i = 0; i < nTufts; i++){
//var position = new THREE.Vector3()
//position.x = (Math.random()-0.5)*20
//position.z = (Math.random()-0.5)*20
//positions[i] = position
//}
//var mesh = THREEx.createGrassTufts(positions)
//scene.add(mesh)
//// load the texture
//var textureUrl = THREEx.createGrassTufts.baseUrl+'images/grass02.png'
//var material = mesh.material
//material.map = THREE.ImageUtils.loadTexture(textureUrl)
//material.alphaTest = 0.7
////////////////////////////////////////////////////////////////////////////////////
//// comment //
////////////////////////////////////////////////////////////////////////////////////
//var nTufts = 100
//var positions = new Array(nTufts)
//for(var i = 0; i < nTufts; i++){
//var position = new THREE.Vector3()
//position.x = (Math.random()-0.5)*20
//position.z = (Math.random()-0.5)*20
//positions[i] = position
//}
//var mesh = THREEx.createGrassTufts(positions)
//scene.add(mesh)
//// load the texture
//var material = mesh.material
//var textureUrl = THREEx.createGrassTufts.baseUrl+'images/flowers01.png'
//material.map = THREE.ImageUtils.loadTexture(textureUrl)
//material.emissive.set(0x888888)
//material.alphaTest = 0.7
////////////////////////////////////////////////////////////////////////////////////
//// comment //
////////////////////////////////////////////////////////////////////////////////////
//var nTufts = 100
//var positions = new Array(nTufts)
//for(var i = 0; i < nTufts; i++){
//var position = new THREE.Vector3()
//position.x = (Math.random()-0.5)*20
//position.z = (Math.random()-0.5)*20
//positions[i] = position
//}
//var mesh = THREEx.createGrassTufts(positions)
//scene.add(mesh)
//// load the texture
//var material = mesh.material
//var textureUrl = THREEx.createGrassTufts.baseUrl+'images/flowers02.png'
//material.map = THREE.ImageUtils.loadTexture(textureUrl)
//material.emissive.set(0x888888)
//material.alphaTest = 0.7
var list =[
275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728
];
var list2 =[
101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,100,101,102
];
var list3 =[
275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728
];
var list4 =[
101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,100,101,102
];
var list5 =[
275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728
];
var list6 =[
101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,100,101,102
];
var list7 =[
275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728
];
var list8 =[
101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,100,101,102
];
var nTufts = 15000
var positions = new Array(nTufts)
for(var i = 0; i < nTufts; i++){
var position = new THREE.Vector3()
position.x = (Math.random()-0.5)*20
position.z = (Math.random()-0.5)*20
//console.log("liste", list);
//console.log("pozicija", position.x);
var roundedString = position.x.toFixed(0);
var roundedString2 = position.y.toFixed(0);
console.log("string", typeof(roundedString));
console.log("array", typeof(list));
listar = Object.values(list);
listar2 = Object.values(list2);
//position.x should be without commas
console.log("array99", listar);
if(listar.includes(roundedString) == false || listar2.includes(roundedString2 == false)){
console.log("notiek");
positions[i] = position
};
}
console.log("dope", positions);
var mesh = THREEx.createGrassTufts(positions)
scene.add(mesh)
var textureUrl = THREEx.createGrassTufts.baseUrl+'images/grass01.png'
var material = mesh.material
material.map = THREE.ImageUtils.loadTexture(textureUrl)
material.alphaTest = 0.7
var nTufts = 15000
var positions = new Array(nTufts)
for(var i = 0; i < nTufts; i++){
var position = new THREE.Vector3()
position.x = (Math.random()-0.5)*20
position.z = (Math.random()-0.5)*20
var roundedString3 = position.x.toFixed(0);
var roundedString4 = position.y.toFixed(0);
console.log("string", roundedString);
listar3 = Object.values(list3);
listar4 = Object.values(list4);
if(listar3.includes(roundedString3) == false || listar4.includes(roundedString4) == false){
positions[i] = position
};
}
var mesh = THREEx.createGrassTufts(positions)
scene.add(mesh)
var textureUrl = THREEx.createGrassTufts.baseUrl+'images/grass02.png'
var material = mesh.material
material.map = THREE.ImageUtils.loadTexture(textureUrl)
material.alphaTest = 0.7
var nTufts = 15000
var positions = new Array(nTufts)
for(var i = 0; i < nTufts; i++){
var position = new THREE.Vector3()
position.x = (Math.random()-0.5)*20
position.z = (Math.random()-0.5)*20
var roundedString5 = position.x.toFixed(0);
var roundedString6 = position.y.toFixed(0);
listar5 = Object.values(list);
listar6 = Object.values(list2);
if(listar5.includes(roundedString5) == false || listar6.includes(roundedString6) == false){
positions[i] = position
};
}
var mesh = THREEx.createGrassTufts(positions)
scene.add(mesh)
var material = mesh.material
var textureUrl = THREEx.createGrassTufts.baseUrl+'images/flowers01.png'
material.map = THREE.ImageUtils.loadTexture(textureUrl)
material.emissive.set(0x888888)
material.alphaTest = 0.7
var nTufts = 15000
var positions = new Array(nTufts)
for(var i = 0; i < nTufts; i++){
var position = new THREE.Vector3()
position.x = (Math.random()-0.5)*20
position.z = (Math.random()-0.5)*20
var roundedString7 = position.x.toFixed(0);
var roundedString8 = position.y.toFixed(0);
listar7 = Object.values(list);
listar8 = Object.values(list2);
if(listar7.includes(roundedString7) == false || listar8.includes(roundedString8) == false){
positions[i] = position
};
}
var mesh = THREEx.createGrassTufts(positions)
scene.add(mesh)
var material = mesh.material
var textureUrl = THREEx.createGrassTufts.baseUrl+'images/flowers02.png'
material.map = THREE.ImageUtils.loadTexture(textureUrl)
material.emissive.set(0x888888)
material.alphaTest = 0.7
//////////////////////////////////////////////////////////////////////////////////
// Camera Controls //
//////////////////////////////////////////////////////////////////////////////////
var mouse = {x : 0, y : 0}
//document.addEventListener('mousemove', function(event){
//mouse.x = (event.clientX / window.innerWidth ) - 0.5
//mouse.y = (event.clientY / window.innerHeight) - 0.5
//}, false)
onRenderFcts.push(function(delta, now){
//camera.position.x += (mouse.x*2 - camera.position.x) * (delta*3)
//camera.position.y += (mouse.y*2 - camera.position.y) * (delta*3)
camera.lookAt( scene.position )
})
//////////////////////////////////////////////////////////////////////////////////
// render the scene //
//////////////////////////////////////////////////////////////////////////////////
onRenderFcts.push(function(){
renderer.render( scene, camera );
})
//////////////////////////////////////////////////////////////////////////////////
// loop runner //
//////////////////////////////////////////////////////////////////////////////////
var lastTimeMsec= null
requestAnimationFrame(function animate(nowMsec){
// keep looping
requestAnimationFrame( animate );
// measure time
lastTimeMsec = lastTimeMsec || nowMsec-1000/60
var deltaMsec = Math.min(200, nowMsec - lastTimeMsec)
lastTimeMsec = nowMsec
// call each update function
onRenderFcts.forEach(function(onRenderFct){
onRenderFct(deltaMsec/1000, nowMsec/1000)
})
})
</script></body>