받침 중심 정렬 + 부재별 색상 구분
bearing.rs: X 중심, Y 하방향 (-h to 0) 기하학 수정 bridge_scene.rs: 받침 X 오프셋 제거 (girder 정렬) Mesh: colors 필드 추가 + recolor() 메서드 sweep.rs / occt.rs: 기본 콘크리트 색 자동 채움 bridge_scene: 부재별 색상 (거더/슬래브/받침/교대) shader.wgsl: base_color 입력 → 조명 계산에 적용 선택(Selection) 기능은 계획대로 별도 Sprint에 구현. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,18 +33,20 @@ use glam;
|
||||
|
||||
// ─── Vertex ───────────────────────────────────────────────────────────────────
|
||||
|
||||
/// Per-vertex data sent to GPU: 3D position + surface normal.
|
||||
/// Per-vertex data sent to GPU: position + normal + base color.
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
|
||||
struct Vertex {
|
||||
position: [f32; 3],
|
||||
normal: [f32; 3],
|
||||
position: [f32; 3],
|
||||
normal: [f32; 3],
|
||||
base_color: [f32; 3], // material base colour (modulated by lighting)
|
||||
}
|
||||
|
||||
impl Vertex {
|
||||
const ATTRIBS: [wgpu::VertexAttribute; 2] = wgpu::vertex_attr_array![
|
||||
const ATTRIBS: [wgpu::VertexAttribute; 3] = wgpu::vertex_attr_array![
|
||||
0 => Float32x3, // position
|
||||
1 => Float32x3, // normal
|
||||
2 => Float32x3, // base_color
|
||||
];
|
||||
|
||||
fn desc() -> wgpu::VertexBufferLayout<'static> {
|
||||
@@ -151,8 +153,10 @@ impl RenderState {
|
||||
let mesh = bridge_scene::build_bridge_scene(&PureRustKernel)
|
||||
.expect("PureRustKernel bridge scene");
|
||||
|
||||
let verts: Vec<Vertex> = mesh.vertices.iter().zip(mesh.normals.iter())
|
||||
.map(|(p, n)| Vertex { position: *p, normal: *n })
|
||||
let verts: Vec<Vertex> = mesh.vertices.iter()
|
||||
.zip(mesh.normals.iter())
|
||||
.zip(mesh.colors.iter())
|
||||
.map(|((p, n), c)| Vertex { position: *p, normal: *n, base_color: *c })
|
||||
.collect();
|
||||
|
||||
let vertex_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
|
||||
Reference in New Issue
Block a user