Skip to content

Instantly share code, notes, and snippets.

@Y0lan
Created October 18, 2018 15:49
Show Gist options
  • Save Y0lan/cc137a19a8f6a13f4678bbb9ca145b19 to your computer and use it in GitHub Desktop.
Save Y0lan/cc137a19a8f6a13f4678bbb9ca145b19 to your computer and use it in GitHub Desktop.
function CreateDolmen(x, z){
dolmen = new THREE.Object3D();
var geometry = new THREE.BoxGeometry( 1, 3, 1 );
var textureUrl = 'images/rocks.jpg'
var texture = THREE.ImageUtils.loadTexture(textureUrl);
texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.repeat.x= 1
texture.repeat.y= 1
texture.anisotropy = renderer.getMaxAnisotropy()
var material = new THREE.MeshPhongMaterial({
map : texture,
emissive: 'gray',
})
//pilier1
pilier1 = new THREE.Mesh( geometry, material );
pilier1.position.set(x,1.25,z);
//pilier2
pilier2 = new THREE.Mesh( geometry, material );
pilier2.position.set(x+2,1.25,z);
//toit
var geometry = new THREE.BoxGeometry( 4, 1, 1.25 );
toit = new THREE.Mesh( geometry, material );
toit.position.set(x+1,3,z);
dolmen.add( pilier1 );
dolmen.add( pilier2 );
dolmen.add( toit);
dolmen.position.set(x,0,z);
dolmen.castShadow = true;
dolmen.receiveShadow = false;
scene.add( dolmen );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment