V0 publique « Quelque part en 2035 » : la maquette du test axo devient la page du build
Retours de Jules du 30/09 (points 1 à 5, décision du 08/10) : - harmonie de la planche sur toute la scène (palette relevée sur le sol, grain de papier procédural, traits des volumes) ; - aucun arbre dans l'eau, plantes d'eau du recueil p. 19 et 21 ; - arbres paramétriques : content/essences.md (recueil p. 10-11) pilote haies, vergers, forêt ; haies sur les limites de parcelles, trois côtés (pipeline/axo/09_haies_eau.py) ; - 2035 sans voitures : vélos, vélos-cargos, attelage, moutons et chèvres, poules, canards, une voiture partagée ; - navigation par chapitres ancrée sur une maison témoin, menu des quatre fils sur le modèle d'ORENO p. 6 ; - bascule plan retirée. Mise en public : Three.js et Barlow servis par le build (plus de CDN ni de Google Fonts), tout le texte dans content/ (fiches, essences, cycle de l'eau) lu et validé au build par scripts/contenu.ts. Lint de frontières rendu portable (Windows). Shader des rubans corrigé pour Three r170. Groupe « aujourd'hui » caché au départ (défaut du 27/09). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a4d99f92cd
commit
c6755ef4a7
@@ -0,0 +1,129 @@
|
||||
// La vie de 2035 (retours de Jules du 30/09) : moutons et chèvres sous les haies, poules près des maisons, canards
|
||||
// sur la mare, oiseaux, et sur les routes des vélos, des vélos-cargos, un attelage et une seule voiture, partagée.
|
||||
// Formes de jouet en bois : quelques volumes simples, dans les couleurs de la planche.
|
||||
import * as THREE from 'three';
|
||||
import { rnd } from './vegetal.js';
|
||||
|
||||
const lam = (c) => new THREE.MeshLambertMaterial({ color: c, emissive: '#000000' });
|
||||
const mesh = (geo, m, x = 0, y = 0, z = 0, ombre = true) => { const o = new THREE.Mesh(geo, m); o.position.set(x, y, z); o.castShadow = ombre; return o; };
|
||||
const boule = (r, sx = 1, sy = 1, sz = 1) => new THREE.SphereGeometry(r, 10, 7).scale(sx, sy, sz);
|
||||
const boite = (x, y, z) => new THREE.BoxGeometry(x, y, z);
|
||||
|
||||
export const MAT = {
|
||||
laine: lam('#f3eee2'), tete: lam('#4f463e'), chevre: lam('#b49a78'), poule: lam('#c98a52'), pouleB: lam('#f1ebdf'), crete: lam('#c0443a'),
|
||||
canard: lam('#e9e3d2'), canardT: lam('#4f7a5a'), bec: lam('#e0a33a'), cheval: lam('#8a5f3c'), criniere: lam('#4a3628'), bois: lam('#b68f5f'),
|
||||
roue: lam('#5c4c3c'), velo: lam('#3e3c37'), caisse: lam('#c9a46a'), partage: lam('#7fa3a6'), toitP: lam('#f2efe6'), oiseau: lam('#5a5650'),
|
||||
chien: lam('#9a7350'),
|
||||
};
|
||||
|
||||
export function mouton() {
|
||||
const g = new THREE.Group();
|
||||
g.add(mesh(boule(0.55, 1.35, 0.85, 0.95), MAT.laine, 0, 0.75, 0));
|
||||
g.add(mesh(boule(0.22, 1.2, 1, 0.9), MAT.tete, 0.78, 0.9, 0));
|
||||
for (const [x, z] of [[0.4, 0.25], [0.4, -0.25], [-0.4, 0.25], [-0.4, -0.25]]) g.add(mesh(boite(0.08, 0.42, 0.08), MAT.tete, x, 0.21, z, false));
|
||||
return g;
|
||||
}
|
||||
export function chevre() {
|
||||
const g = new THREE.Group();
|
||||
g.add(mesh(boule(0.42, 1.45, 0.85, 0.85), MAT.chevre, 0, 0.82, 0));
|
||||
g.add(mesh(boule(0.18, 1.4, 1, 0.85), MAT.chevre, 0.7, 1.12, 0));
|
||||
g.add(mesh(new THREE.ConeGeometry(0.04, 0.22, 4), MAT.tete, 0.66, 1.33, 0.06, false), mesh(new THREE.ConeGeometry(0.04, 0.22, 4), MAT.tete, 0.66, 1.33, -0.06, false));
|
||||
for (const [x, z] of [[0.35, 0.18], [0.35, -0.18], [-0.35, 0.18], [-0.35, -0.18]]) g.add(mesh(boite(0.07, 0.5, 0.07), MAT.tete, x, 0.25, z, false));
|
||||
return g;
|
||||
}
|
||||
export function poule(i) {
|
||||
const g = new THREE.Group();
|
||||
g.add(mesh(boule(0.17, 1.3, 1, 1), i % 3 ? MAT.poule : MAT.pouleB, 0, 0.24, 0));
|
||||
g.add(mesh(boule(0.09), i % 3 ? MAT.poule : MAT.pouleB, 0.17, 0.4, 0));
|
||||
g.add(mesh(boite(0.05, 0.07, 0.03), MAT.crete, 0.18, 0.5, 0, false));
|
||||
return g;
|
||||
}
|
||||
export function canard() {
|
||||
const g = new THREE.Group();
|
||||
g.add(mesh(boule(0.2, 1.5, 0.75, 1), MAT.canard, 0, 0.1, 0));
|
||||
g.add(mesh(boule(0.1), MAT.canardT, 0.26, 0.28, 0));
|
||||
g.add(mesh(boite(0.1, 0.03, 0.06), MAT.bec, 0.38, 0.26, 0, false));
|
||||
return g;
|
||||
}
|
||||
export function attelage() {
|
||||
const g = new THREE.Group();
|
||||
const cheval = new THREE.Group();
|
||||
cheval.add(mesh(boule(0.5, 1.6, 0.85, 0.75), MAT.cheval, 0, 1.45, 0));
|
||||
cheval.add(mesh(boite(0.32, 0.75, 0.3), MAT.cheval, 0.78, 1.85, 0));
|
||||
cheval.add(mesh(boule(0.22, 1.5, 0.9, 0.9), MAT.cheval, 1.0, 2.2, 0));
|
||||
cheval.add(mesh(boite(0.5, 0.12, 0.08), MAT.criniere, 0.62, 2.12, 0, false));
|
||||
for (const [x, z] of [[0.5, 0.2], [0.5, -0.2], [-0.5, 0.2], [-0.5, -0.2]]) cheval.add(mesh(boite(0.12, 1.05, 0.12), MAT.cheval, x, 0.52, z, false));
|
||||
cheval.position.x = 1.7; g.add(cheval);
|
||||
g.add(mesh(boite(2.2, 0.5, 1.4), MAT.bois, -0.6, 1.0, 0));
|
||||
g.add(mesh(boite(0.6, 0.35, 0.5), MAT.caisse, -0.9, 1.42, 0.2), mesh(boite(0.5, 0.3, 0.45), lam('#a9be7c'), -0.2, 1.4, -0.25));
|
||||
for (const z of [0.78, -0.78]) g.add(mesh(new THREE.CylinderGeometry(0.55, 0.55, 0.12, 14).rotateX(Math.PI / 2), MAT.roue, -0.6, 0.55, z));
|
||||
g.add(mesh(new THREE.CapsuleGeometry(0.24, 0.55, 3, 8), lam('#6f8fa8'), 0.25, 1.65, 0));
|
||||
return g;
|
||||
}
|
||||
export function velo(couleur) {
|
||||
const g = new THREE.Group();
|
||||
g.add(mesh(boite(1.7, 0.1, 0.12), MAT.velo, 0, 0.62, 0));
|
||||
for (const x of [0.7, -0.7]) g.add(mesh(new THREE.TorusGeometry(0.32, 0.04, 5, 14), MAT.velo, x, 0.34, 0, false));
|
||||
g.add(mesh(new THREE.CapsuleGeometry(0.24, 0.62, 3, 8), lam(couleur), -0.1, 1.32, 0));
|
||||
return g;
|
||||
}
|
||||
export function veloCargo(couleur) {
|
||||
const g = new THREE.Group();
|
||||
g.add(mesh(boite(2.5, 0.1, 0.12), MAT.velo, 0, 0.55, 0));
|
||||
for (const x of [1.05, -0.95]) g.add(mesh(new THREE.TorusGeometry(0.3, 0.04, 5, 14), MAT.velo, x, 0.32, 0, false));
|
||||
g.add(mesh(boite(0.85, 0.6, 0.8), MAT.caisse, 0.75, 0.88, 0));
|
||||
g.add(mesh(boule(0.18), lam('#c8553d'), 0.6, 1.25, 0.15), mesh(boule(0.16), lam('#a9be7c'), 0.9, 1.24, -0.15));
|
||||
g.add(mesh(new THREE.CapsuleGeometry(0.24, 0.62, 3, 8), lam(couleur), -0.55, 1.28, 0));
|
||||
return g;
|
||||
}
|
||||
export function voiture(couleur, partagee = false) {
|
||||
const g = new THREE.Group(), m = partagee ? MAT.partage : lam(couleur);
|
||||
g.add(mesh(boite(4.2, 0.9, 1.8), m, 0, 0.65, 0));
|
||||
g.add(mesh(boite(2.3, 0.75, 1.62), m, -0.25, 1.45, 0));
|
||||
if (partagee) {
|
||||
g.add(mesh(boite(0.7, 0.28, 0.5), MAT.toitP, -0.25, 1.98, 0));
|
||||
for (const [x, z] of [[0.3, 0.45], [-0.6, 0.45], [-0.6, -0.45]]) g.add(mesh(boule(0.2), lam('#e6c96a'), x, 1.55, z, false));
|
||||
}
|
||||
return g;
|
||||
}
|
||||
export function chien() {
|
||||
const g = new THREE.Group();
|
||||
g.add(mesh(boule(0.18, 1.6, 0.9, 0.8), MAT.chien, 0, 0.36, 0));
|
||||
g.add(mesh(boule(0.12), MAT.chien, 0.3, 0.5, 0));
|
||||
for (const [x, z] of [[0.18, 0.08], [0.18, -0.08], [-0.18, 0.08], [-0.18, -0.08]]) g.add(mesh(boite(0.05, 0.26, 0.05), MAT.chien, x, 0.13, z, false));
|
||||
return g;
|
||||
}
|
||||
export function oiseau() {
|
||||
const g = new THREE.Group(), geo = new THREE.BufferGeometry();
|
||||
geo.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, -0.25, 0, 0.55, 0.15, 0, 0, 0, 0, 0, 0.15, 0, 0, -0.25, 0, -0.55], 3));
|
||||
geo.computeVertexNormals();
|
||||
const ailes = new THREE.Mesh(geo, new THREE.MeshLambertMaterial({ color: '#5a5650', side: THREE.DoubleSide }));
|
||||
g.add(ailes); g.userData.ailes = ailes;
|
||||
return g;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- troupeau, basse-cour, canards, oiseaux
|
||||
export function vieAnimale(D, G2035) {
|
||||
const anim = [];
|
||||
const troupeau = new THREE.Group(), basse = new THREE.Group(), mare = new THREE.Group(), ciel = new THREE.Group();
|
||||
G2035.add(troupeau, basse, mare, ciel);
|
||||
D.troupeaux.forEach(([x, z, espece, rot], i) => {
|
||||
const o = espece === 0 ? mouton() : chevre(); o.position.set(x, 0, z); o.rotation.y = rot; troupeau.add(o);
|
||||
anim.push((t) => { o.rotation.y = rot + Math.sin(t * 0.3 + i) * 0.35; o.children[1].position.y = (espece === 0 ? 0.9 : 1.12) - (Math.sin(t * 0.8 + i * 2) > 0.6 ? 0.18 : 0); });
|
||||
});
|
||||
D.poules.forEach(([x, z, rot], i) => {
|
||||
const o = poule(i); o.position.set(x, 0, z); o.rotation.y = rot; basse.add(o);
|
||||
anim.push((t) => { const k = Math.sin(t * 2.2 + i * 1.7); o.rotation.z = k > 0.5 ? -0.5 : 0; o.position.x = x + Math.sin(t * 0.25 + i) * 0.4; });
|
||||
});
|
||||
const { c, r, n } = D.canards;
|
||||
for (let i = 0; i < n; i++) {
|
||||
const o = canard(); mare.add(o);
|
||||
anim.push((t) => { const a = t * 0.12 + (i / n) * Math.PI * 2, rr = r * (0.55 + 0.35 * Math.sin(i * 1.7)); o.position.set(c[0] + Math.cos(a) * rr, 0.05, c[1] + Math.sin(a) * rr); o.rotation.y = -a - Math.PI / 2; });
|
||||
}
|
||||
const centres = [[c[0], c[1]], [100, -40]];
|
||||
for (let i = 0; i < 9; i++) {
|
||||
const o = oiseau(); ciel.add(o); const [cx, cz] = centres[i % 2]; const R = 9 + (i % 4) * 4, h = 13 + (i % 3) * 3, v = 0.25 + rnd(i) * 0.15;
|
||||
anim.push((t) => { const a = t * v + i; o.position.set(cx + Math.cos(a) * R, h + Math.sin(t * 0.7 + i) * 0.8, cz + Math.sin(a) * R); o.rotation.y = -a; o.userData.ailes.scale.z = 0.4 + 0.6 * Math.abs(Math.sin(t * 7 + i)); });
|
||||
}
|
||||
return { anim, troupeau, basse, mare };
|
||||
}
|
||||
Reference in New Issue
Block a user