Exemple #1
0
 public MeshResources(MarchingCubeAsset asset, int maxGridLength) : this()
 {
     this.argsBufferForInstancing = ComputeShaderUtility.CreateIndirectArgumentsBufferForInstancing();
     this.argsBufferForDispatch   = ComputeShaderUtility.CreateIndirectArgumentsBufferForDispatch();
     this.instancesBuffer         = createCubeIdInstancingShaderBuffer_(32 * 32 * 32 * maxGridLength);
     this.baseVtxsBuffer          = createBaseVtxShaderBuffer_(asset.BaseVertexList);
     this.idxListsBuffer          = createIdxListsShaderBuffer_(asset.CubeIdAndVertexIndicesList);
     this.gridPositionBuffer      = createGridPositionShaderBuffer_(maxGridLength);
     this.nearGridIdBuffer        = createNearGridShaderBuffer_(maxGridLength);
     this.triNormalsBuffer        = createTriangleNormalshaderBuffer_(asset.CubeIdAndVertexIndicesList);
     //this.vtxNormalsBuffer = createVertexNormalshaderBuffer_( maxGridLength );
     this.gridCubeIdBuffer = createGridCubeIdShaderBuffer_(maxGridLength);
     this.cubeNormalBuffer = createCubeNormalShaderBuffer_();//
     this.mesh             = createMesh_();
 }
Exemple #2
0
            public MeshResources(MarchingCubeAsset asset, int maxGridLength) : this()
            {
                this.ArgsBufferForInstancing = ComputeShaderUtility.CreateIndirectArgumentsBufferForInstancing();
                this.ArgsBufferForDispatch   = ComputeShaderUtility.CreateIndirectArgumentsBufferForDispatch();

                this.CubeInstancesBuffer = createCubeIdInstancingShaderBuffer_(32 * 32 * 32 * maxGridLength);
                this.GridCubeIdBuffer    = createGridCubeIdShaderBuffer_(maxGridLength);

                var vertexNormalDict = makeVertexNormalsDict_(asset.CubeIdAndVertexIndicesList); Debug.Log(vertexNormalDict.Count);

                this.NormalBuffer      = createNormalList_(vertexNormalDict);
                this.CubePatternBuffer = createCubePatternBuffer_(asset.CubeIdAndVertexIndicesList, vertexNormalDict);
                this.CubeVertexBuffer  = createCubeVertexBuffer_(asset.BaseVertexList);
                this.GridBuffer        = createGridShaderBuffer_(512);

                this.mesh = createMesh_();
            }