VoxelSmooth.h
1 /************************************************************
2 * (C) Voxel Farm Inc. 2015
3 */
4 
5 #pragma once
6 
7 #include "mapindex.h"
8 #include "Generator.h"
9 #include "BlockData.h"
10 
11 namespace VoxelFarm
12 {
13  const int SMOOTH_KERNEL_LINK_MAX = 16;
14  const int RAISE_KERNEL_LINK_MAX = 48;
15 
18  void smoothKernel(
20  VoxelFarm::CellId targetCell,
22  int targetCellX,
24  int targetCellY,
26  int targetCellZ,
28  int kernelMargin,
30  int kernelSizeX,
32  int kernelSizeY,
34  int kernelSizeZ,
36  int iterations,
38  float blendWeight,
40  IBlockData& blockData,
42  VoxelFarm::CGenerator& generator,
44  TSet<CellId>* changedCells,
45 
46  // Work buffers.
47  // Can be shared by multiple calls from the same thread.
48  // This is to avoid heap fragmentation in long-running environments.
50  MaterialId* kernelMaterials,
52  double* kernelPoints,
54  double* kernelPointsNext,
56  int* kernelVertexLinks,
58  int* kernelVertexLinkCount,
60  float* kernelWeight,
61  CMaterialLibrary* materialLibrary);
62 
63  void addSmoothBlock(
64  // Data interface to block layer
65  IBlockData& blockData,
66  // Start coordinate for block
67  CellId c1, int x1, int y1, int z1,
68  // Block dimensions in voxels
69  int dx, int dy, int dz,
70  // Defines the transition size of the kernel's area of influence. Voxels in the kernel boundaries are not affected by the operation to avoid discontinuities.
71  int kernelMargin,
72  // Number of smoothing iterations to be performed
73  int iterations,
74  // Controls the weight of each voxel compared to its neighbors. Higher values produce changes at lower rates.
75  float blendWeight,
76  // A CGenerator instance that provides the contents of the voxels to be smoothen
77  VoxelFarm::CGenerator& generator, // const...
78  // A set to collect which cells were changed. Pass NULL if not interested in this info
79  TSet<CellId>* changedCells,
80  // Material for block
81  MaterialId material);
82 
85  void raiseKernel(
87  VoxelFarm::CellId targetCell,
89  int targetCellX,
91  int targetCellY,
93  int targetCellZ,
95  int kernelMargin,
97  int kernelSizeX,
99  int kernelSizeY,
101  int kernelSizeZ,
103  int iterations,
105  float blendWeight,
107  IBlockData& blockData,
109  VoxelFarm::CGenerator& generator,
111  TSet<CellId>* changedCells,
112 
113  // Work buffers.
114  // Can be shared by multiple calls from the same thread.
115  // This is to avoid heap fragmentation in long-running environments.
117  MaterialId* kernelMaterials,
119  double* kernelPoints,
121  double* kernelPointsNext,
123  int* kernelVertexLinks,
125  int* kernelVertexLinkCount,
127  float* kernelWeight,
128  CMaterialLibrary* materialLibrary);
129 
130 }
Combines several voxel layers into the final dataset sent to the contouring phase.
Definition: Generator.h:20
Contains all classes and functions for the VoxelFarm engine.
unsigned __int64 CellId
A 64bit integer that identifies a single world octree Cell.
Definition: mapindex.h:23
void raiseKernel(VoxelFarm::CellId targetCell, int targetCellX, int targetCellY, int targetCellZ, int kernelMargin, int kernelSizeX, int kernelSizeY, int kernelSizeZ, int iterations, float blendWeight, IBlockData &blockData, VoxelFarm::CGenerator &generator, TSet< CellId > *changedCells, MaterialId *kernelMaterials, double *kernelPoints, double *kernelPointsNext, int *kernelVertexLinks, int *kernelVertexLinkCount, float *kernelWeight, CMaterialLibrary *materialLibrary)
void smoothKernel(VoxelFarm::CellId targetCell, int targetCellX, int targetCellY, int targetCellZ, int kernelMargin, int kernelSizeX, int kernelSizeY, int kernelSizeZ, int iterations, float blendWeight, IBlockData &blockData, VoxelFarm::CGenerator &generator, TSet< CellId > *changedCells, MaterialId *kernelMaterials, double *kernelPoints, double *kernelPointsNext, int *kernelVertexLinks, int *kernelVertexLinkCount, float *kernelWeight, CMaterialLibrary *materialLibrary)