🚀 Auto-deploy: BrainWind atualizado em 29/07/2026 10:44:07
This commit is contained in:
@@ -5,6 +5,7 @@ import * as THREE from 'three';
|
||||
import SceneCanvas from '../SceneCanvas';
|
||||
import FallbackDiagram from '../FallbackDiagram';
|
||||
import { useCanvasTheme } from '@/lib/theme';
|
||||
import { DomeAirflowSystem } from './DomeAirflowSystem';
|
||||
|
||||
export interface Dome3DInput {
|
||||
diameter: number;
|
||||
@@ -14,6 +15,7 @@ export interface Dome3DInput {
|
||||
cpeBarlavento: number;
|
||||
cpeTopo: number;
|
||||
cpeLateral: number;
|
||||
viewMode?: 'solid' | 'airflow';
|
||||
}
|
||||
|
||||
function domeColor(cpe: number, cpi: number, isDark: boolean): THREE.Color {
|
||||
@@ -26,9 +28,10 @@ function domeColor(cpe: number, cpi: number, isDark: boolean): THREE.Color {
|
||||
return new THREE.Color(`hsl(0, ${70 + intensity * 25}%, ${Math.max(40, l + 5)}%)`);
|
||||
}
|
||||
|
||||
function DomeModel({ diameter, rise, wallHeight, cpi, cpeBarlavento, cpeTopo, cpeLateral }: Dome3DInput) {
|
||||
function DomeModel({ diameter, rise, wallHeight, cpi, cpeBarlavento, cpeTopo, cpeLateral, viewMode = 'solid' }: Dome3DInput) {
|
||||
const theme = useCanvasTheme();
|
||||
const isDark = theme === 'dark';
|
||||
const isAirflow = viewMode === 'airflow';
|
||||
const radius = diameter / 2;
|
||||
const segments = 64;
|
||||
|
||||
@@ -64,7 +67,7 @@ function DomeModel({ diameter, rise, wallHeight, cpi, cpeBarlavento, cpeTopo, cp
|
||||
{/* Parede cilíndrica inferior */}
|
||||
<mesh position={[0, wallHeight / 2, 0]} castShadow receiveShadow>
|
||||
<cylinderGeometry args={[radius, radius, wallHeight, segments, 1, false]} />
|
||||
<meshStandardMaterial color="#cbd5e1" opacity={0.8} transparent roughness={0.4} />
|
||||
<meshStandardMaterial color="#cbd5e1" opacity={isAirflow ? 0.25 : 0.8} transparent roughness={0.4} />
|
||||
</mesh>
|
||||
|
||||
{/* Detalhes de anéis metálicos nas bordas */}
|
||||
@@ -124,7 +127,7 @@ function DomeModel({ diameter, rise, wallHeight, cpi, cpeBarlavento, cpeTopo, cp
|
||||
<bufferAttribute attach="attributes-normal" args={[new Float32Array(normals), 3]} />
|
||||
<bufferAttribute attach="index" args={[new Uint16Array(indices), 1]} />
|
||||
</bufferGeometry>
|
||||
<meshStandardMaterial color={zone.color} opacity={0.92} transparent roughness={0.4} side={THREE.DoubleSide} />
|
||||
<meshStandardMaterial color={zone.color} opacity={isAirflow ? 0.35 : 0.92} transparent roughness={0.4} side={THREE.DoubleSide} />
|
||||
</mesh>
|
||||
);
|
||||
})}
|
||||
@@ -139,22 +142,24 @@ function DomeModel({ diameter, rise, wallHeight, cpi, cpeBarlavento, cpeTopo, cp
|
||||
<cylinderGeometry args={[0.1, 0.1, 1.2, 16]} />
|
||||
<meshStandardMaterial color="#3b82f6" roughness={0.3} />
|
||||
</mesh>
|
||||
<Text
|
||||
position={[0, -1.5, 0]}
|
||||
rotation={[Math.PI / 2, 0, 0]}
|
||||
fontSize={0.4}
|
||||
color="#3b82f6"
|
||||
anchorX="center"
|
||||
anchorY="middle"
|
||||
>
|
||||
Vento
|
||||
</Text>
|
||||
</group>
|
||||
|
||||
{/* Texto Vento */}
|
||||
<Text
|
||||
position={[radius + 2.5, wallHeight / 2 + 1.2, 0]}
|
||||
rotation={[0, 0, 0]}
|
||||
fontSize={1.2}
|
||||
color="#3b82f6"
|
||||
anchorX="center"
|
||||
anchorY="bottom"
|
||||
>
|
||||
Vento
|
||||
</Text>
|
||||
|
||||
{/* Texto informativo */}
|
||||
<Text
|
||||
position={[0, wallHeight + rise + 0.8, 0]}
|
||||
fontSize={Math.max(0.3, Math.min(0.6, diameter / 12))}
|
||||
fontSize={Math.max(0.35, Math.min(0.7, (diameter / 12) * 1.3))}
|
||||
color={isDark ? "#cbd5e1" : "#1a202c"}
|
||||
anchorX="center"
|
||||
anchorY="bottom"
|
||||
@@ -168,6 +173,7 @@ function DomeModel({ diameter, rise, wallHeight, cpi, cpeBarlavento, cpeTopo, cp
|
||||
export default function Dome3DViewer(props: Dome3DInput) {
|
||||
const theme = useCanvasTheme();
|
||||
const isDark = theme === 'dark';
|
||||
const { viewMode = 'solid' } = props;
|
||||
|
||||
const fallback = (
|
||||
<FallbackDiagram
|
||||
@@ -181,6 +187,7 @@ export default function Dome3DViewer(props: Dome3DInput) {
|
||||
return (
|
||||
<SceneCanvas moduleId="cupula"
|
||||
shadows
|
||||
frameloop={viewMode === 'airflow' ? 'always' : 'demand'}
|
||||
gl={{ preserveDrawingBuffer: true, antialias: true }}
|
||||
camera={{ position: [props.diameter * 1.5, (props.wallHeight + props.rise) * 1.5, props.diameter * 1.5], fov: 40 }}
|
||||
fallback={fallback}
|
||||
@@ -199,6 +206,9 @@ export default function Dome3DViewer(props: Dome3DInput) {
|
||||
shadow-camera-bottom={-maxDim}
|
||||
/>
|
||||
<DomeModel {...props} />
|
||||
{viewMode === 'airflow' && (
|
||||
<DomeAirflowSystem diameter={props.diameter} rise={props.rise} wallHeight={props.wallHeight} />
|
||||
)}
|
||||
<Grid
|
||||
infiniteGrid
|
||||
fadeDistance={maxDim * 5}
|
||||
|
||||
Reference in New Issue
Block a user