14 #include "MatrixAlg.h"
15 #include "FastQuadrics.h"
18 #include "VoxelLayer.h"
20 #include "ExternalMutex.h"
24 #include "StampMesh.h"
29 namespace Architecture
90 TMap<int, InstanceIndex*>
lod;
216 TMap<String, int>* materials;
250 InstanceArray* meshInstances;
278 virtual void runJobs()
override;
284 void loadMesh(String
id,
char* filename);
292 double orientation[3],
296 TMap<String, int>* materials,
308 void* threadContext)
override;
319 return STAT_LSYS_RUN;
332 EntityIndex entityIndex;
334 TVector<Entity*> entityIndexObjects;
337 TMap<String, CFastQuadrics*> meshes;
338 TMap<int, std::pair<CGrammar*, CModule*>> modules;
339 TMap<int, std::pair<CGrammar*, CModule*>> prefabs;
341 TMap<CellId, InstanceArray> instanceCache;
342 TMap<CellId, EntityArray> cellToEntityMap;
344 TSet<std::pair<int, Entity*>> pending;
345 TVector<GenerationRequest*> pendingOrder;
346 TSet<GenerationRequest*> processing;
347 TSet<CellId> generatedCells;
348 TMap<String, int>* defaultMaterials;
349 TVector<IEntityGenerator*> generators;
358 TVector<EntityAABB> allEntities;
365 const double boxSize[3],
367 const double boxWorldPos[3],
368 TSet<CellId>* changedCells,
RTree< Entity *, double, 3, double, 32 > EntityIndex
RTree index to speed up spacial queries for entities.
A thread context for the archicteture system. A single instance of the architecture system can be sha...
int prefabCount()
Returns the count of loaded prefabs.
double decay
An entropy value to simulate decay and breackage for the entity.
double xsize
Indentifies the ideal X dimention.
Tracks a single instance of a mesh. An architecture entity will be composed of many mesh instances...
const int MASTER_ARCH_GENERATION_LEVEL
Octree level at which architecture is generated.
Algebra::Vector size
Scale for the instance.
Entity * entity
Reference to the entity to which the instance belongs.
CPaletteDesc * paletteIndex
An index to all palettes.
double ysize
Indentifies the ideal Y dimention.
int intersectionListCount
Total number of intersection lists.
TMap< String, int > * materials
A map that resolves alphanumeric material IDs as defined in the grammar source code to numeric materi...
double groundLevel
Height of the ground level for the instance.
const unsigned int MAX_INTERSECTIONS
Limit for the intersections to be tracked during voxelization.
Contains all classes and functions for the VoxelFarm engine.
const int BLOCK_SIZE
Actual number of voxels in one Cell Dim once the margin is considered.
int id
Identifies the prefab id in the prefabs collection in architecture.
Tracks a generation request for an entity.
int rayTestCount
Number of ray tests records in use.
virtual int getStatsRunJobsId() override
Returns the stats ID to be used for measuring performance of the runJobs() method.
set material to 0 for deleting with the instance
A default implementation of IBlockData that also acts as a VoxelLayer.
double maxBounds[3]
Maximum bounds for the instance.
An Entity is an unique architecture element. The entity struct tracks the location and type of the en...
const int ARCH_MAX_LEVEL
Max Octree level at which architecture is voxelized and returned for contouring.
Architecture system. It keeps a list of entities, their classes and the mesh instances they have prod...
double minxsize
Indentifies the minimum X dimention.
do not use a palette...take the material from the entity material list
It allows to access to the faces and materials of a list of solids.
This interface allows the architecture engine to delegate the creation of entities to the application...
ScopeType scopeType
Type of scope for the instance (Box or Prism)
TVector< InstancedMesh * > InstanceArray
A list of instances.
void registerGenerator(IEntityGenerator *generator)
Registers an IEntityGenerator.
bool volumeIsClear(double minVol[3], double maxVol[3])
Returns wheter there are entities in the specified volume.
double orientation[3]
Orientation for the entity in degrees over each main coordinate axis.
unsigned __int64 CellId
A 64bit integer that identifies a single world octree Cell.
CFastQuadrics * loadMesh(char *filename)
Loads a mesh from a file (*.dat)
virtual int getFaceCount(int solid)
Returns the number of faces in a solid.
Cells Scene
A Scene is a set of cells.
int rayTestHead
Index for the first item in the test list.
An interface for a voxel layer. By implementing this interface, very different modules can contribute...
void loadMesh(String id, char *filename)
Loads and registers a mesh file (*.dat) The provided ID is the one used in the "instance" commands in...
TMap< int, InstanceIndex * > lod
Index of all the instances that were produced for the entity, grouped by architecture LOD...
int * intersectionIndex
A 3D index that links a voxels to the list of intersections found for it.
int prefabCount
Number of prefab.
double * cellHeightCache
A buffer to cache height data.
int classId
Class identifier for the entity. Grammar rules to generate the entity are defined at the class level...
virtual int getSolidCount()
Returns the number of solids.
virtual MaterialId getSolidMaterial(int solid)
Returns the material of a solid.
virtual void getFace(int solid, int index, Algebra::Vector &v0, Algebra::Vector &v1, Algebra::Vector &v2)
Get the vertices of a face of a solid.
Algebra::Matrix transform
Position and rotation of the instance.
void loadPrefab(int id, char *filename)
Loads and registers a grammar prefab with the specified class ID. The filename must point to a compil...
A Matrix for 3D operations.
int material
Material for the instance.
RayIntersection * intersections
A buffer to store intersection nodes.
double minzsize
Indentifies the minimum Z dimention.
double minysize
Indentifies the minimum Y dimention.
virtual void runJobs() override
Processes pending generation requests. This is called by the contouring loop. Pending entities will b...
virtual void disposeThreadContext(void *threadContext) override
Disposes an architecture thread context.
take as material the user material in use
A prefab definition for the VoxelFarm.com engine.
void loadModule(int id, char *filename)
Loads and registers a grammar module with the specified class ID. The filename must point to a compil...
PaletteType
Type of palette of materials when collecting instances.
virtual void * createThreadContext() override
Creates a new instance of an architecture thread context.
double minBounds[3]
Minimum bounds for the instance.
Contains all palette descriptions available in the system.
virtual void getContourData(CellId cell, VoxelFarm::ContourVoxelData *data, bool &empty, void *threadContext) override
Returns voxel data for the specified cell.
A record that tracks intersection points along one ray.
RayTest * rayTests
A buffer to store ray test records.
CFastQuadrics * mesh
A reference to a polygonal mesh for the instance.
double size[3]
Scale for the entity. Determines the size of the initial scope used by the generation system...
void generateEntities(CellId cell)
Uses the registered IEntityGenerator to generate entities for the cell.
RayIntersectionList * intersectionLists
A buffer to store intersection lists.
Contains all prefab descriptions available in the system.
RTree< InstancedMesh *, double, 3, double, 32 > InstanceIndex
An RTree index to accelerate spatial instance queries.
ScopeType
Enumerates possible scope types.
int intersectionCount
Total number of intersections found.
CPrefabDesc * prefabIndex
An index to all prefab.
virtual void generateEntities(CellId cell, CArchitectureManager &architectureManager)=0
Generates entities for the specified cell.
double position[3]
Position for the entity in world coordinates.
This class allows to access meshes in a list of instances.
const unsigned int MAX_TEST_INTERSECTIONS
Limit for the intersections to be tracked along one ray.
An efficient mesh representation that features Quadratic Error function simplification using a Multip...
choose the material from a palette of materials
An intersection list produced during the voxelization process.
virtual int getStatsContourId() override
Returns the stats ID to be used for measuring performance of the getContourData() method...
A palette of materials definition for the VoxelFarm.com engine.
virtual void planJobs(Scene *scene) override
Processes a scene to get new entities from it. This is called by the scene creation loop...
void addEntity(double position[3], double size[3], double orientation[3], int classId, TMap< String, int > *materials, double groundLevel, double decay)
Adds one entity.
double zsize
Indentifies the ideal Z dimention.
int paletteCount
Number of palettes.
TVector< Entity * > EntityArray
A list of entities.
A record used to create intersection lists during the voxelization process.
It translates a given material depending of the position in the world.