add light to show back

This commit is contained in:
TreetopFlyer 2021-07-11 16:44:34 -04:00
parent 4078e026ef
commit 20e8d90ec3
2 changed files with 4 additions and 45 deletions

View File

@ -34,17 +34,18 @@ let surfaceTest = () =>
let surfaceGeometry = new THREE.BufferGeometry(); let surfaceGeometry = new THREE.BufferGeometry();
surfaceGeometry.setAttribute('position', new THREE.BufferAttribute(surface.vert, 3) ); surfaceGeometry.setAttribute('position', new THREE.BufferAttribute(surface.vert, 3) );
surfaceGeometry.setIndex(surface.triPointVert); surfaceGeometry.setIndex(surface.triPointVert);
surfaceGeometry.computeVertexNormals(); surfaceGeometry.computeVertexNormals(true);
let surfaceObject = new THREE.Mesh( let surfaceObject = new THREE.Mesh(
surfaceGeometry, surfaceGeometry,
new THREE.MeshBasicMaterial({color:0xaa9900, wireframe:true}) new THREE.MeshPhongMaterial({color:0xaa9900, side:THREE.DoubleSide, shading:THREE.FlatShading})
); );
return { return {
DOM:"canvas", DOM:"canvas",
Init(inScene) Init(inScene)
{ {
inScene.add(new THREE.PointLight(0xffffff, 1, 100))
inScene.add(surfaceObject); inScene.add(surfaceObject);
inScene.add(new THREE.GridHelper(10, 10)); inScene.add(new THREE.GridHelper(10, 10));
}, },

View File

@ -1,47 +1,5 @@
export const Kernel =
{
Corners:
[
[ 1, 1, -1],
[ 1, -1, -1],
[-1, 1, -1],
[-1, -1, -1],
[ 1, 1, 1],
[ 1, -1, 1],
[-1, 1, 1],
[-1, -1, 1]
],
Cardinal:
[
[ 1, 0, 0],
[ 0, 1, 0],
[-1, 0, 0],
[ 0, -1, 0],
[ 0, 0, 1],
[ 0, 0, -1]
],
Loop(inList, inVector, inHandler)
{
for(let i=0; i<inList.length; i++)
{
let delta = inList[i];
if(inHandler(inVector[0]+delta[0], inVector[1]+delta[1], inVector[2]+delta[2]))
{
return;
}
}
}
};
export const Region = export const Region =
{ {
Create()
{
return {
Voxels:[],
Filled:[],
Surface:[]
};
},
I(inX, inY, inZ) I(inX, inY, inZ)
{ {
return inX + inY*16 + inZ*256; return inX + inY*16 + inZ*256;