Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created July 3, 2016 01:05
Show Gist options
  • Save AndrewRayCode/493c213b3915acb3529a7afaf38ffbd1 to your computer and use it in GitHub Desktop.
Save AndrewRayCode/493c213b3915acb3529a7afaf38ffbd1 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import THREE from 'three';
export default class Wall extends Component {
shouldComponentUpdate( nextProps ) {
return ( nextProps.position !== this.props.position ) ||
( nextProps.rotation !== this.props.rotation ) ||
( nextProps.quaternion !== this.props.quaternion ) ||
( nextProps.scale !== this.props.scale ) ||
( nextProps.materialId !== this.props.materialId );
}
render() {
const {
position, rotation, quaternion, scale, materialId,
} = this.props;
return <group
position={ position }
quaternion={ quaternion }
rotation={ rotation }
scale={ scale }
>
<mesh
ref="mesh"
>
<geometryResource
resourceId="1x1box"
/>
<materialResource
resourceId={ materialId }
/>
</mesh>
</group>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment