Skip to content

Instantly share code, notes, and snippets.

@Colmea
Created April 8, 2016 09:28
Show Gist options
  • Save Colmea/a3d6a4acdef023c58897b4060deb1976 to your computer and use it in GitHub Desktop.
Save Colmea/a3d6a4acdef023c58897b4060deb1976 to your computer and use it in GitHub Desktop.
import React from 'react';
import React3 from 'react-three-renderer';
import THREE from 'three';
import {Timber as TimberComponent} from '../../../../core/components/Timber';
export default class LongitudinalCut010 extends React.Component {
vertices: array;
faces: array;
constructor(props, context) {
super(props, context);
this.updateVertices(props);
}
updateVertices(newProps) {
this.vertices = [
// update vertices based on props
];
this.faces = [
// update faces based on props
];
}
componentWillReceiveProps(nextProps) {
// update geometry with new props
this.updateVertices(nextProps);
}
render() {
const {transformation} = this.props;
return (
<mesh
ref="transformation3D"
visible={true}
>
<geometry
name={transformation.id}
vertices={this.vertices}
faces={this.faces}
/>
<materialResource resourceId={'transformationMaterial'} />
</mesh>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment