Adjust scene lighting, attach light to camera for consistent lighting
This commit is contained in:
@@ -5,7 +5,11 @@ import * as React from 'react'
|
||||
import * as THREE from 'three'
|
||||
import { EdgeSplitModifier } from 'three-stdlib'
|
||||
|
||||
export function useEdgeSplit(cutOffAngle: number, tryKeepNormals: boolean = true, dependantGeometry?: any) {
|
||||
export function useEdgeSplit(
|
||||
cutOffAngle: number,
|
||||
tryKeepNormals = true,
|
||||
dependantGeometry?: any
|
||||
) {
|
||||
const ref = React.useRef<THREE.Mesh>()
|
||||
const original = React.useRef<THREE.BufferGeometry>()
|
||||
const modifier = React.useRef<EdgeSplitModifier>()
|
||||
@@ -19,7 +23,11 @@ export function useEdgeSplit(cutOffAngle: number, tryKeepNormals: boolean = true
|
||||
|
||||
React.useEffect(() => {
|
||||
if (original.current && ref.current && modifier.current) {
|
||||
const modifiedGeometry = modifier.current.modify(original.current, cutOffAngle, tryKeepNormals)
|
||||
const modifiedGeometry = modifier.current.modify(
|
||||
original.current,
|
||||
cutOffAngle,
|
||||
tryKeepNormals
|
||||
)
|
||||
modifiedGeometry.computeVertexNormals()
|
||||
|
||||
ref.current.geometry = modifiedGeometry
|
||||
|
||||
Reference in New Issue
Block a user