slab rendering + select
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
import { useRegistry, type SlabNode } from '@pascal-app/core'
|
||||
import { type SlabNode, useRegistry } from '@pascal-app/core'
|
||||
import { useRef } from 'react'
|
||||
import type { Mesh } from 'three'
|
||||
import { useNodeEvents } from '../../../hooks/use-node-events'
|
||||
|
||||
export const SlabRenderer = ({ node }: { node: SlabNode }) => {
|
||||
const ref = useRef<Mesh>(null!)
|
||||
|
||||
useRegistry(node.id, 'slab', ref)
|
||||
|
||||
const handlers = useNodeEvents(node, 'slab')
|
||||
|
||||
return (
|
||||
<mesh ref={ref} castShadow receiveShadow>
|
||||
<mesh ref={ref} castShadow receiveShadow {...handlers}>
|
||||
{/* SlabSystem will replace this geometry in the next frame */}
|
||||
<boxGeometry args={[0, 0, 0]} />
|
||||
<meshStandardMaterial color="#e5e5e5" />
|
||||
|
||||
@@ -5,6 +5,8 @@ import {
|
||||
emitter,
|
||||
type ItemEvent,
|
||||
type ItemNode,
|
||||
type SlabEvent,
|
||||
type SlabNode,
|
||||
type WallEvent,
|
||||
type WallNode,
|
||||
type ZoneEvent,
|
||||
@@ -17,6 +19,7 @@ type NodeConfig = {
|
||||
wall: { node: WallNode; event: WallEvent }
|
||||
building: { node: BuildingNode; event: BuildingEvent }
|
||||
zone: { node: ZoneNode; event: ZoneEvent }
|
||||
slab: { node: SlabNode; event: SlabEvent }
|
||||
}
|
||||
|
||||
type NodeType = keyof NodeConfig
|
||||
|
||||
Reference in New Issue
Block a user