Monumento a la bandera

main
Sebastián Santisi 1 year ago
parent 2d5b06d4ad
commit 448db3ae31

Binary file not shown.

@ -436,10 +436,14 @@ class WindSimulation {
this.wms[i].animate();
//this.wms[i].rotation.z += 0.01;
}
renderer.render(scene, camera);
flag.animate();
/*
cone.rotation.y = 0.1 * Math.sin(Date.now() / 1000);
cone.rotation.x = 0.08 * Math.sin(Date.now() / 5000);
*/
renderer.render(scene, camera);
}
simulate() {
@ -481,21 +485,71 @@ class WindSimulation {
}
const loader = new STLLoader();
loader.load('./casa_80.stl', function(geometry) {
//loader.load('./casa_80.stl', function(geometry) {
loader.load('./MonumentoBandera.stl', function(geometry) {
var material = new THREE.MeshBasicMaterial({color: 0xffffff});
var mesh = new THREE.Mesh(geometry, material);
var scale = 0.0005;
mesh.scale.set(scale, scale, scale);
var scale = 0.0093;
mesh.scale.setScalar(scale);
mesh.rotation.z = -Math.PI / 2;
mesh.position.x = 9.8;
mesh.position.y = 0.2;
mesh.position.x = 9.5;
mesh.position.y = 0.3;
scene.add(mesh);
window.casa = mesh;
});
// Based on https://codepen.io/okada-web/pen/OJydGzy?editors=0010
class ArgentinianFlag extends THREE.Group {
constructor(height) {
super();
var geometry = new THREE.PlaneGeometry(3,2,30,20);
var colors = new three.BufferAttribute(new Float32Array(geometry.attributes.position.array.length), 3);
geometry.setAttribute('color', colors);
for(var i = 0; i < colors.count; i++)
if(i < 31 * 7 || i >= 31 * 14)
colors.setXYZ(i, 117/255, 170/255, 219/255);
else
colors.setXYZ(i, 1, 1, 1);
var material = new THREE.MeshBasicMaterial({side:THREE.DoubleSide, vertexColors: true});
this.mesh = new THREE.Mesh(geometry,material);
this.mesh.rotateX(Math.PI/2);
var scale = height / 3;
this.mesh.position.x = 1.5 * scale;
this.mesh.position.z = 1 * scale;
this.mesh.scale.setScalar(scale);
this.add(this.mesh);
}
animate() {
var hor = 0.3;
var speed = 0.1;
var ver = 0.1;
var swing = 0.5;
var pos = this.mesh.geometry.attributes.position;
const time = Date.now() * speed / 50;
for (let y=0; y<20+1; y++) {
for (let x=0; x<30+1; x++) {
const index = x + y * (30+1);
const vertex = pos[index];
pos.setZ(index, Math.sin(hor * x + ver * y - time) * swing * x / 40);
}
}
pos.needsUpdate = true;
}
}
var flag = new ArgentinianFlag(0.3);
scene.add(flag);
window.flag = flag;
flag.position.set(9.5, 0.3, 0.3);
flag.rotation.z = Math.PI;
/*
var geometry = new THREE.CylinderGeometry(0.09, 0.03, 0.5, 10, 5, true);
geometry = geometry.toNonIndexed();
const colors = new three.BufferAttribute(new Float32Array(geometry.attributes.position.array.length), 3);
var colors = new three.BufferAttribute(new Float32Array(geometry.attributes.position.array.length), 3);
geometry.setAttribute('color', colors);
for(var i = 0; i < colors.count; i++) {
if((Math.trunc(i / 6) + Math.trunc(i / 30) % 2) % 2)
@ -503,14 +557,18 @@ var geometry = new THREE.CylinderGeometry(0.09, 0.03, 0.5, 10, 5, true);
else
colors.setXYZ(i, 1, 0.3, 0);
}
const material = new THREE.MeshBasicMaterial({vertexColors: true});
var material = new THREE.MeshBasicMaterial({vertexColors: true, side: THREE.DoubleSide});
var mesh = new THREE.Mesh(geometry, material);
mesh.position.z = 1;
mesh.position.x = 9.5;
mesh.position.y = 0.5;
mesh.rotation.z = -Math.PI / 2;
var cone = mesh;
scene.add(mesh);
scene.add(mesh);*/
var ws = new WindSimulation(10, 10, 5);
window.ws = ws;
@ -529,7 +587,7 @@ function hide() {
<div id="close" onclick="hide();"></div>
<div id="text">
<img src="logooscuro.png" style="width: 30vh;" /><br />
<p>Simulador de interacción entre turbinas.</p>
<p>Simulador de Aerogeneradores y Parques Eólicos (SAPE)</p>
<p>Centro de Simulación Computacional para Aplicaciones Tecnológicas - CONICET</p>
</div>
</div>

Loading…
Cancel
Save