Atoms Crowd  7.0.0
Variations.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <Atoms/Globals.h>
11 #include <AtomsCore/Hash.h>
12 #include <AtomsUtils/Logger.h>
13 
14 #include <vector>
15 #include <map>
16 #include <algorithm>
17 #include <numeric>
18 
19 namespace Atoms
20 {
21  class Variations;
22  class AgentTypeVariation;
23  class VariationGeometry;
24  class VariationMaterial;
25  class VariationGroup;
26  class VariationOverride;
27  class VariationGroupLod;
28  class VariationMaterialColor;
29  class VariationTree;
30  class VariationTreeGeo;
31  class MaterialConstraint;
32  class ExcludeGeometry;
33 
43 
44  typedef const Variations* VariationsCPtr;
54 
55  typedef std::map<std::string, VariationTreeGeo> VariationTreeGeoMap;
56  typedef std::map<std::string, MaterialConstraint> MaterialConstraintMap;
57  typedef std::map<std::string, ExcludeGeometry> ExcludeGeometryMap;
58 
60 
63  class ATOMS_EXPORT VariationGeometry
64  {
65  public:
68  m_geometryFilter("*") {}
69 
72 
74  const std::string& getGeometryFile() const { return m_geometryFile; };
75 
77  void setGeometryFile(const std::string& geometryFile) { m_geometryFile = geometryFile; };
78 
80  const std::string& getGeometryFilter() const { return m_geometryFilter; };
81 
83  void setGeometryFilter(const std::string& filter) { m_geometryFilter = filter; };
84 
86  void hash(AtomsCore::MurmurHash3& hasher) const;
87 
88  private:
89 
91  std::string m_geometryFile;
92 
94  std::string m_geometryFilter;
95  };
96 
98  /* This class stores material color rgb values.
99  */
100  class ATOMS_EXPORT VariationMaterialColor
101  {
102  public:
104  m_red(0),
105  m_green(0),
106  m_blue(0)
107  {}
108 
110  void setRed(const int red) { m_red = red > 255 ? 255 : red < 0 ? 0 : red; }
112  void setGreen(const int green) { m_green = green > 255 ? 255 : green < 0 ? 0 : green; }
114  void setBlue(const int blue) { m_blue = blue > 255 ? 255 : blue < 0 ? 0 : blue; }
115 
116  unsigned int getRed() const { return m_red; }
117  unsigned int getGreen() const { return m_green; }
118  unsigned int getBlue() const { return m_blue; }
119 
121  void hash(AtomsCore::MurmurHash3& hasher) const;
122 
123  private:
124  unsigned int m_red;
125  unsigned int m_green;
126  unsigned int m_blue;
127  };
128 
129 
131  /* This class Stores a material file path used by the renderers.
132  * It also stores some diffuse/specular/normal attributes used for previsualization inside the DCC
133  */
134  class ATOMS_EXPORT VariationMaterial
135  {
136  public:
137 
140  m_diffuseWeight(1.0f),
141  m_specularWeight(0.0f),
142  m_specularRollOff(0.7f),
143  m_specularEccentricity(0.3f)
144  {
145  m_diffuseFiles.resize(1);
146  m_diffuseRGBs.resize(1);
147  };
148 
151 
153  const std::string& getMaterialFile() const { return m_materialFile; };
154 
156  void setMaterialFile(const std::string& materialFile) { m_materialFile = materialFile; };
157 
159  void setDiffuseSlotSize(unsigned int size);
160 
162  unsigned int getDiffuseSlotSize() const;
163 
165  const std::string& getDiffuseFile(unsigned int index = 0) const;
166 
168  const std::string& getSpecularFile() const;
169 
171  const std::string& getNormalMapFile() const;
172 
174  void setDiffuseFile(const std::string& diffuseFile, unsigned int index = 0);
175 
177  void setSpecularFile(const std::string& specularFile);
178 
180  void setNormalMapFile(const std::string& normalMapFile);
181 
183  const VariationMaterialColor& getDiffuseColor(unsigned int index = 0) const;
184  VariationMaterialColor& getDiffuseColor(unsigned int index = 0);
185 
186  VariationMaterialColorCPtr getDiffuseColorPtr(unsigned int index = 0);
187 
189  unsigned int getDiffuseColorRed() const;
190 
192  unsigned int getDiffuseColorGreen() const;
193 
195  unsigned int getDiffuseColorBlue() const;
196 
198  void setDiffuseColorRed(const int red);
199 
201  void setDiffuseColorGreen(const int green);
202 
204  void setDiffuseColorBlue(const int blue);
205 
208 
210  unsigned int getSpecularColorRed() const;
211 
213  unsigned int getSpecularColorGreen() const;
214 
216  unsigned int getSpecularColorBlue() const;
217 
219  void setSpecularColorRed(const int red);
220 
222  void setSpecularColorGreen(const int green);
223 
225  void setSpecularColorBlue(const int blue);
226 
228  float getDiffuseWeight() const;
230  void setDiffuseWeight(float value);
231 
233  const std::string& getDiffuseHueMetadataName() const;
234 
236  void setDiffuseHueMetadataName(const std::string& value);
237 
239  const std::string& getDiffuseSlotMetadataName() const;
240 
242  void setDiffuseSlotMetadataName(const std::string& value);
243 
245  float getSpecularWeight() const;
247  void setSpecularWeight(float value);
248 
250  float getSpecularRollOff() const;
252  void setSpecularRollOff(float value);
253 
255  float getSpecularEccentricity() const;
257  void setSpecularEccentricity(float value);
258 
260  void hash(AtomsCore::MurmurHash3& hasher) const;
261 
262  private:
263 
265  std::string m_materialFile;
266 
268  std::vector<std::string> m_diffuseFiles;
269 
271  std::string m_specularFile;
272 
274  std::string m_normalMapFile;
275 
277  float m_diffuseWeight;
278 
280  float m_specularWeight;
281 
283  float m_specularRollOff;
284 
286  float m_specularEccentricity;
287 
289  std::string m_diffuseHueMetadataName;
290 
292  std::string m_diffuseSlotMetadataName;
293 
295  VariationMaterialColor m_specularRGB;
296 
298  std::vector<VariationMaterialColor> m_diffuseRGBs;
299 
300  };
301 
302  class ATOMS_EXPORT BaseVariationGroup
303  {
304  public:
306  BaseVariationGroup(AgentTypeVariationCPtr agentTypeVariation) : m_atVariation(agentTypeVariation) {}
307 
310 
313 
315  inline void clear() { m_combinations.clear(); }
316 
318  inline unsigned int numCombinations() const { return static_cast<unsigned int>(m_combinations.size()); }
319 
321  inline bool hasCombination(const std::string& geometryName, const std::string& materialName);
322 
324  void addCombination(const std::string& geometryName, const std::string& materialName);
325 
327  inline const std::pair<std::string, std::string>& getCombinationAtIndex(unsigned int index) const;
328 
330  inline bool removeCombinationAtIndex(unsigned int index);
331 
333  void hash(AtomsCore::MurmurHash3& hasher) const;
334 
336  const std::vector<std::pair<std::string, std::string>>& getCombinations() const { return m_combinations; };
337 
338  protected:
339 
341 
344 
346  std::vector<std::pair<std::string, std::string>> m_combinations;
347 
349  std::pair<std::string, std::string> m_emptyPair;
350  };
351 
353  /* A variation group contains multiple combinations of geoemtry-material.
354  * This class is used to store a variation group for a lod definition of an agent type variation
355  */
356  class ATOMS_EXPORT VariationGroupLod : public BaseVariationGroup
357  {
359  };
360 
362  /* A variation group contains multiple combinations of geoemtry-material.
363  * This class is used to store a variation group of an agent type variation and
364  * the variation groups of lods
365  */
366  class ATOMS_EXPORT VariationGroup: public BaseVariationGroup
367  {
368  public:
370 
372  VariationGroup(AgentTypeVariationCPtr agentTypeVariation, const VariationGroup& vg);
373 
375  inline std::vector<std::string> getLodNames() const;
376 
378  inline bool hasLod(const std::string& name) const { return m_lods.find(name) != m_lods.end(); }
379 
381  VariationGroupLod& getLod(const std::string& name);
382 
384  inline VariationGroupLodCPtr getLodPtr(const std::string &name) const;
385 
387  inline bool removeLod(const std::string &name);
388 
390  inline void setLod(const std::string &name, const VariationGroupLod& v) { m_lods.insert(std::make_pair(name, VariationGroupLod(m_atVariation, v))); }
391 
393  void hash(AtomsCore::MurmurHash3& hasher) const;
394 
395  private:
396 
398  std::map<std::string, VariationGroupLod> m_lods;
399  };
400 
402  /* A Material Constraint contain the rule for constraining a geo to a material
403  */
404  class ATOMS_EXPORT ExcludeGeometry
405  {
406  public:
407  ExcludeGeometry() {}
408  ExcludeGeometry(const std::string& sourceGeometry, const std::string& destinationGeometry) : m_sourceGeometry(sourceGeometry), m_destinationGeometry(destinationGeometry) {}
409  void hash(AtomsCore::MurmurHash3& hasher) const;
410 
411  void setSourceGeometry(const std::string& sourceGeometry) { m_sourceGeometry = sourceGeometry; }
412  const std::string& getSourceGeometry() const { return m_sourceGeometry; }
413 
414  void setDestinationGeometry(const std::string& destinationGeometry) { m_destinationGeometry = destinationGeometry; }
415  const std::string& getDestinationGeometry() const { return m_destinationGeometry; }
416 
417  private:
418  std::string m_sourceGeometry;
419  std::string m_destinationGeometry;
420  };
421 
423  /* A variation override can contain multiple combinations of geometry-material and a list of geometries to filter.
424  * This class is used to store overrides to change the look of a variation
425  */
426  class ATOMS_EXPORT VariationOverride: public BaseVariationGroup
427  {
428  public:
430 
433 
435  unsigned int numGeometryFilter() const { return static_cast<unsigned int>(m_geometryFilter.size()); }
436 
438  inline bool hasGeometryFilter(const std::string& geometryName) const;
439 
441  void addGeometryFilter(const std::string& geometryName);
442 
444  inline const std::string& getGeometryFilterAtIndex(unsigned int index) const;
445 
447  inline bool removeGeometryFilterAtIndex(unsigned int index);
448 
450  void hash(AtomsCore::MurmurHash3& hasher) const;
451 
453  const std::vector<std::string>& getGeometryFilters() const { return m_geometryFilter;}
454 
455  private:
456 
458  std::vector<std::string> m_geometryFilter;
459 
460  static std::string m_emptyString;
461  };
462 
463  class ATOMS_EXPORT MaterialOverride
464  {
465  public:
466  MaterialOverride(AgentTypeVariationCPtr vt) : m_atVariation(vt) {}
467 
468  void hash(AtomsCore::MurmurHash3& hasher) const;
469 
471  unsigned int numMaterials() const { return static_cast<unsigned int>(m_materialNames.size()); }
472 
474  inline bool hasMaterial(const std::string& materialName) const;
475 
477  inline void addMaterial(const std::string& materialName, const double weight=1.0);
478 
480  inline const std::string& getMaterialNameAtIndex(unsigned int index) const;
481 
483  inline const double getMaterialWeightAtIndex(unsigned int index) const;
484 
486  inline bool removeMaterialAtIndex(unsigned int index);
487 
488  private:
489  std::vector<std::string> m_materialNames;
490  std::vector<double> m_materialWeights;
491  AgentTypeVariationCPtr m_atVariation;
492 
493  static std::string m_emptyString;
494  };
495 
497  /* A Variation Tree Geo contains a hierarchy of meshes for the Variation Tree
498  */
499  class ATOMS_EXPORT VariationTreeGeo
500  {
501  public:
502  enum GeoType
503  {
504  kGeo = 0,
505  kNone,
506  kVariationType,
507  kExtraGeo
508  };
509 
510  VariationTreeGeo(AgentTypeVariationCPtr vt, const std::string &name) : m_atVariation(vt), m_name(name), m_weight(1), m_locked(false), m_type(GeoType::kVariationType), m_materialOverride(vt) {}
511  VariationTreeGeo(AgentTypeVariationCPtr vt, const std::string& name, const double weight, const bool locked, const GeoType geoType): m_atVariation(vt), m_name(name), m_weight(weight), m_locked(locked), m_type(geoType), m_materialOverride(vt) { }
512 
513  void hash(AtomsCore::MurmurHash3& hasher) const;
514 
515  void addChild(const std::string& name, VariationTreeGeo& vg);
516  const VariationTreeGeoMap& getChildren() const { return m_children; }
517  void clearChildren() { m_children.clear(); }
518 
519  void setLocked(const bool locked) { m_locked = locked; }
520  const bool getLocked() const { return m_locked; }
521 
522  void setWeight(const double weight) { m_weight = weight; }
523  const double getWeight() const { return m_weight; }
524 
525  void setGeoType(const GeoType geoType) { m_type = geoType; }
526  const GeoType getGeoType() const { return m_type; }
527 
528  const MaterialOverride& getMaterialOverride() const { return m_materialOverride; };
529  MaterialOverride& getMaterialOverride() { return m_materialOverride; };
530 
531  void addExcludeGeometry(const std::string& name, const ExcludeGeometry& eg);
532  const ExcludeGeometryMap& getExcludeGeometries() const { return m_excludeGeometries; };
533  ExcludeGeometryMap& getExcludeGeometries() { return m_excludeGeometries; };
534 
535  const std::string& getName() const { return m_name; }
536 
537  AgentTypeVariationCPtr getAgentTypeVariation() const { return m_atVariation; }
538 
539  private:
540 
541  AgentTypeVariationCPtr m_atVariation;
542  std::string m_name;
543  double m_weight;
544  bool m_locked;
545  GeoType m_type;
546  MaterialOverride m_materialOverride;
547  ExcludeGeometryMap m_excludeGeometries;
548  VariationTreeGeoMap m_children;
549  };
550 
552  /* A Material Constraint contain the rule for constraining a geo to a material
553  */
554  class ATOMS_EXPORT MaterialConstraint
555  {
556  public:
557  MaterialConstraint() {}
558  MaterialConstraint(const std::string &material, const std::string& geometryName, const std::string& destinationMaterialName ) : m_material(material), m_geometryName(geometryName), m_destinationMaterialName(destinationMaterialName) {}
559  void hash(AtomsCore::MurmurHash3& hasher) const;
560 
561  void setMaterial(const std::string& material) { m_material = material; }
562  const std::string& getMaterial() const { return m_material; }
563 
564  void setGeometryName(const std::string& geometryName) { m_geometryName = geometryName; }
565  const std::string& getGeometryName() const { return m_geometryName; }
566 
567  void setDestinationMaterialName(const std::string& destinationMaterialName) { m_destinationMaterialName = destinationMaterialName; }
568  const std::string& getDestinationMaterialName() const { return m_destinationMaterialName; }
569 
570  private:
571  std::string m_material;
572  std::string m_geometryName;
573  std::string m_destinationMaterialName;
574  };
575 
577  /* A variation tree contains the rules for building variations at run time
578  */
579  class ATOMS_EXPORT VariationTree
580  {
581  public:
582 
584  VariationTree(AgentTypeVariationCPtr agentTypeVariation) : m_atVariation(agentTypeVariation), m_geoMatSuffixRepl(std::pair<std::string, std::string>("_GEO", "_*_MAT")) {}
585 
587  VariationTree(AgentTypeVariationCPtr agentTypeVariation, const VariationTree& variationTree);
588 
591 
593  inline void clear();
594 
596  const VariationTreeGeoMap& getVariationTypes() const { return m_variationTypes; };
597 
599  bool hasVariationType(const std::string& name) const { return m_variationTypes.find(name) != m_variationTypes.end(); };
600 
602  const VariationTreeGeoMap& getExtraGeos() const { return m_extraGeos; };
603 
605  const MaterialConstraintMap& getMaterialConstraints() const { return m_materialConstraints; };
606 
608  const ExcludeGeometryMap& getExcludeGeometries() const { return m_excludeGeometries; };
609 
611  inline void addVariationType(const std::string& name, const VariationTreeGeo& vg);
612 
614  inline void addExtraGeo(const std::string& name, const VariationTreeGeo& vg);
615 
617  inline void addMaterialConstraint(const std::string& name, const MaterialConstraint& mc);
618 
620  inline void addExcludeGeometry(const std::string& name, const ExcludeGeometry& mc);
621 
623  inline void setGeoMatSuffixReplacement(const std::string& geo, const std::string& mat) { m_geoMatSuffixRepl.first = geo; m_geoMatSuffixRepl.second = mat;}
624 
626  inline const std::pair<std::string, std::string>& getGeoMatSuffixReplacement() const { return m_geoMatSuffixRepl; }
627 
629  void addGeoMatAliases(const std::string& geo, const std::string& mat);
630 
632  inline const std::vector<std::pair<std::string, std::string>>& getGeoMatAliases() const { return m_geoMatAlias; }
633 
635  inline void setMaterialPrefix(const std::string& materialPrefix) { m_materialPrefix = materialPrefix; }
636 
638  inline const std::string& getMaterialPrefix() const { return m_materialPrefix; }
639 
641  void hash(AtomsCore::MurmurHash3& hasher) const;
642 
644  std::vector<std::pair<std::string, std::string>> build(const std::string &variationType, unsigned agentSeed, unsigned int seed, std::vector<std::string>& debugMessages, const bool storeDebugMessages = false) const;
645 
646  // ! returns the agent type variation
647  AgentTypeVariationCPtr getAgentTypeVariation() const { return m_atVariation; }
648 
649  private:
651 
653  AgentTypeVariationCPtr m_atVariation;
654 
656  VariationTreeGeoMap m_variationTypes;
657 
659  VariationTreeGeoMap m_extraGeos;
660 
662  MaterialConstraintMap m_materialConstraints;
663 
665  ExcludeGeometryMap m_excludeGeometries;
666 
668  std::vector<std::pair<std::string, std::string>> m_geoMatAlias;
669 
671  std::pair<std::string, std::string> m_geoMatSuffixRepl;
672 
674  std::string m_materialPrefix;
675 
676  std::vector<std::string> m_debugMessages;
677  };
678 
680  /* This class stores a list geometries file path and materials file path and
681  * a list of variations groups. Each variation group uses the geometries and materials to define
682  * an agent variation.
683  */
684  class ATOMS_EXPORT AgentTypeVariation
685  {
686  public:
688  AgentTypeVariation() : m_variationTree(this) {};
689 
692 
695 
697  inline void clear();
698 
700  inline std::vector<std::string> getGeometryNames() const;
701 
703  inline std::vector<std::string> getMaterialNames() const;
704 
706  inline std::vector<std::string> getGroupNames() const;
707 
709  inline std::vector<std::string> getOverrideNames() const;
710 
712  inline VariationGeometry& getGeometry(const std::string &name) { return m_geos[name]; }
713 
715  inline VariationMaterial& getMaterial(const std::string &name) { return m_mats[name]; }
716 
718  VariationGroup& getGroup(const std::string &name);
719 
721  VariationOverride& getOverride(const std::string& name);
722 
724  inline VariationTree& getVariationTree() { return m_variationTree; }
725 
727  inline const VariationTree& getVariationTree() const { return m_variationTree; }
728 
730  inline void setGeometry(const std::string &name, const VariationGeometry& v) { m_geos[name] = v; }
731 
733  inline void setMaterial(const std::string &name, const VariationMaterial& v) { m_mats[name] = v; }
734 
736  inline void setClothSetup(const std::string &path) { m_clothSetup = path; }
737 
739  inline void setLookFile(const std::string &path) { m_lookFile = path; }
740 
742  inline void setGroup(const std::string &name, const VariationGroup& v) { m_groups.insert(std::make_pair(name, VariationGroup(this, v))); }
743 
745  inline void setOverride(const std::string& name, const VariationOverride& v) { m_overrides.insert(std::make_pair(name, VariationOverride(this, v))); }
746 
748  inline VariationGeometryCPtr getGeometryPtr(const std::string &name) const;
749 
751  inline VariationMaterialCPtr getMaterialPtr(const std::string &name) const;
752 
754  inline VariationGroupCPtr getGroupPtr(const std::string &name) const;
755 
757  inline VariationOverrideCPtr getOverridePtr(const std::string& name) const;
758 
760  inline const std::string &getClothSetup() const { return m_clothSetup; }
761 
763  inline const std::string &getLookFile() const { return m_lookFile; }
764 
766  inline bool hasGeometry(const std::string &name) const { return m_geos.find(name) != m_geos.end(); }
767 
769  inline bool hasMaterial(const std::string &name) const { return m_mats.find(name) != m_mats.end(); }
770 
772  inline bool hasGroup(const std::string &name) const { return m_groups.find(name) != m_groups.end(); }
773 
775  inline bool hasOverride(const std::string& name) const { return m_overrides.find(name) != m_overrides.end(); }
776 
778  inline bool removeGeometry(const std::string &name);
779 
781  inline bool removeMaterial(const std::string &name);
782 
784  inline bool removeGroup(const std::string &name);
785 
787  inline bool removeOverride(const std::string& name);
788 
790  inline bool removeAllGroups();
791 
793  inline bool removeAllOverrides();
794 
796  void hash(AtomsCore::MurmurHash3& hasher) const;
797 
799  void buildCombinations(const std::string& variationName,
800  const std::string& lodName,
801  const int variationSeed,
802  const int agentSeed,
803  const std::vector<std::string>& variationOverrides,
804  const std::vector<std::string>& geoMatOverrides,
805  const std::vector<std::string>& geometryFilters,
806  std::vector<std::string>& debugMessages,
807  std::vector<std::pair<std::string,
808  std::string>>& combinations,
809  const bool storeDebugMessages = false) const;
810 
811  private:
812 
814  std::map<std::string, VariationGeometry> m_geos;
815 
817  std::map<std::string, VariationMaterial> m_mats;
818 
820  std::map<std::string, VariationGroup> m_groups;
821 
823  std::map<std::string, VariationOverride> m_overrides;
824 
826  VariationTree m_variationTree;
827 
829  std::string m_clothSetup;
830 
832  std::string m_lookFile;
833  };
834 
836 
838  class ATOMS_EXPORT Variations
839  {
840  public:
841 
844 
847 
849  void clear() { m_agentTypeVariations.clear(); };
850 
852  inline std::vector<std::string> getAgentTypeNames() const;
853 
855  inline AgentTypeVariation& getAgentTypeVariation(const std::string &agentTypeName) { return m_agentTypeVariations[agentTypeName]; }
856 
858  inline void setAgentTypeVariation(const std::string &agentTypeName, const AgentTypeVariation& atv) { if (agentTypeName != "") m_agentTypeVariations[agentTypeName] = atv; }
859 
861  inline AgentTypeVariationCPtr getAgentTypeVariationPtr(const std::string &agentTypeName) const;
862 
864  inline bool hasAgentTypeVariation(const std::string &agentTypeName) { return m_agentTypeVariations.find(agentTypeName) != m_agentTypeVariations.end(); }
865 
867  inline bool removeAgentTypeVariation(const std::string &agentTypeName);
868 
870  bool writeToFile(const std::string &filePath);
871 
873  std::string toString(const bool prettyprint = false);
874 
876  void hash(AtomsCore::MurmurHash3& hasher) const;
877 
878  inline size_t size() const;
879 
880  private:
881 
883  std::map<std::string, AgentTypeVariation> m_agentTypeVariations;
884  };
885 }
886 
887 #include <Atoms/Variations.impl.h>
888 
Agent type variation class.
Definition: Variations.h:685
AgentTypeVariation()
Constructor.
Definition: Variations.h:688
const VariationTree & getVariationTree() const
Gets Variation Tree.
Definition: Variations.h:727
~AgentTypeVariation()
Destructor.
Definition: Variations.h:691
bool hasMaterial(const std::string &name) const
Checks if this object contains a material.
Definition: Variations.h:769
void buildCombinations(const std::string &variationName, const std::string &lodName, const int variationSeed, const int agentSeed, const std::vector< std::string > &variationOverrides, const std::vector< std::string > &geoMatOverrides, const std::vector< std::string > &geometryFilters, std::vector< std::string > &debugMessages, std::vector< std::pair< std::string, std::string >> &combinations, const bool storeDebugMessages=false) const
retrieve combinations
VariationGeometry & getGeometry(const std::string &name)
Gets a geometry.
Definition: Variations.h:712
VariationOverride & getOverride(const std::string &name)
Gets a override.
bool hasGroup(const std::string &name) const
Checks if this object contains a group.
Definition: Variations.h:772
bool hasGeometry(const std::string &name) const
Checks if this object contains a geometry.
Definition: Variations.h:766
VariationGroup & getGroup(const std::string &name)
Gets a group.
void setLookFile(const std::string &path)
Sets look file.
Definition: Variations.h:739
bool hasOverride(const std::string &name) const
Checks if this object contains an override.
Definition: Variations.h:775
VariationMaterial & getMaterial(const std::string &name)
Gets a material.
Definition: Variations.h:715
void setGeometry(const std::string &name, const VariationGeometry &v)
Sets a geometry.
Definition: Variations.h:730
void setGroup(const std::string &name, const VariationGroup &v)
Sets a group.
Definition: Variations.h:742
void setOverride(const std::string &name, const VariationOverride &v)
Sets an override.
Definition: Variations.h:745
const std::string & getClothSetup() const
Gets cloth setup file.
Definition: Variations.h:760
VariationTree & getVariationTree()
Gets Variation Tree.
Definition: Variations.h:724
void setClothSetup(const std::string &path)
Sets cloth setup file.
Definition: Variations.h:736
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
const std::string & getLookFile() const
Gets look file.
Definition: Variations.h:763
void setMaterial(const std::string &name, const VariationMaterial &v)
Sets a material.
Definition: Variations.h:733
AgentTypeVariation(const AgentTypeVariation &atv)
Copy constructor.
Definition: Variations.h:303
AgentTypeVariationCPtr m_atVariation
Agent type variation.
Definition: Variations.h:336
BaseVariationGroup(AgentTypeVariationCPtr agentTypeVariation)
Constructor.
Definition: Variations.h:306
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
const std::vector< std::pair< std::string, std::string > > & getCombinations() const
Gets a reference to the combinations vector.
Definition: Variations.h:336
BaseVariationGroup(AgentTypeVariationCPtr agentTypeVariation, const BaseVariationGroup &vg)
Constructor.
std::pair< std::string, std::string > m_emptyPair
Empty combination.
Definition: Variations.h:349
void addCombination(const std::string &geometryName, const std::string &materialName)
Adds a combination.
~BaseVariationGroup()
Destructor.
Definition: Variations.h:312
unsigned int numCombinations() const
Gets the number of combinations.
Definition: Variations.h:318
std::vector< std::pair< std::string, std::string > > m_combinations
Map of combinations.
Definition: Variations.h:346
void clear()
Clear all combinations.
Definition: Variations.h:315
Exclude Geometry.
Definition: Variations.h:405
Material Constraint class.
Definition: Variations.h:555
Definition: Variations.h:464
unsigned int numMaterials() const
Gets the number of materials.
Definition: Variations.h:471
VariationGeometry class.
Definition: Variations.h:64
const std::string & getGeometryFilter() const
Gets the geometry filter.
Definition: Variations.h:80
const std::string & getGeometryFile() const
Gets the geometry file path.
Definition: Variations.h:74
void setGeometryFilter(const std::string &filter)
Sets the geometry file path.
Definition: Variations.h:83
void setGeometryFile(const std::string &geometryFile)
Sets the geometry file path.
Definition: Variations.h:77
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
VariationGeometry()
Constructor.
Definition: Variations.h:67
~VariationGeometry()
Destructor.
Definition: Variations.h:71
Variation group class.
Definition: Variations.h:367
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
bool hasLod(const std::string &name) const
Checks if a lod exists.
Definition: Variations.h:378
VariationGroup(AgentTypeVariationCPtr agentTypeVariation, const VariationGroup &vg)
Constructor.
VariationGroupLod & getLod(const std::string &name)
Gets a lod variation group.
void setLod(const std::string &name, const VariationGroupLod &v)
Sets a lod.
Definition: Variations.h:390
Variation group lod class.
Definition: Variations.h:357
Variation Material Color.
Definition: Variations.h:101
void setRed(const int red)
Sets the diffuse red value.
Definition: Variations.h:110
void setBlue(const int blue)
Sets the diffuse blue value.
Definition: Variations.h:114
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
void setGreen(const int green)
Sets the diffuse green value.
Definition: Variations.h:112
Variation Material.
Definition: Variations.h:135
unsigned int getSpecularColorBlue() const
Gets the specular blue value.
void setSpecularColorBlue(const int blue)
Sets the specular blue value.
unsigned int getDiffuseSlotSize() const
Set diffuse slot size.
float getDiffuseWeight() const
Gets the diffuse weight.
unsigned int getDiffuseColorGreen() const
Gets the diffuse green value.
void setDiffuseWeight(float value)
Sets the diffuse weight.
void setDiffuseSlotSize(unsigned int size)
Set diffuse slot size.
const std::string & getDiffuseFile(unsigned int index=0) const
Gets the diffuse texture path.
const std::string & getNormalMapFile() const
Gets the normal file path.
void setDiffuseHueMetadataName(const std::string &value)
Sets the diffuse hue metadata name.
const std::string & getSpecularFile() const
Gets the specural file path.
void setDiffuseColorBlue(const int blue)
Sets the diffuse blue value.
~VariationMaterial()
Destructor.
Definition: Variations.h:150
float getSpecularRollOff() const
Gets the specular rolloff.
VariationMaterialColor & getSpecularColor()
Gets the specular color.
void setMaterialFile(const std::string &materialFile)
Sets the material file path.
Definition: Variations.h:156
const std::string & getDiffuseSlotMetadataName() const
Gets the diffuse slot metadata name.
unsigned int getDiffuseColorRed() const
Gets the diffuse red value.
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
const VariationMaterialColor & getDiffuseColor(unsigned int index=0) const
Gets the diffuse color.
float getSpecularEccentricity() const
Gets the specular eccentricity.
unsigned int getSpecularColorGreen() const
Gets the specular green value.
void setSpecularColorGreen(const int green)
Sets the specular green value.
void setDiffuseSlotMetadataName(const std::string &value)
Sets the diffuse slot metadata name.
void setNormalMapFile(const std::string &normalMapFile)
Sets the normal file path.
void setSpecularRollOff(float value)
Sets the specular rolloff.
float getSpecularWeight() const
Gets the specular weight.
const std::string & getMaterialFile() const
Gets the material file path.
Definition: Variations.h:153
unsigned int getDiffuseColorBlue() const
Gets the diffuse blue value.
void setDiffuseColorRed(const int red)
Sets the diffuse red value.
void setDiffuseColorGreen(const int green)
Sets the diffuse green value.
void setSpecularFile(const std::string &specularFile)
Sets the specural file path.
void setDiffuseFile(const std::string &diffuseFile, unsigned int index=0)
Sets the diffuse texture path.
VariationMaterial()
Constructor.
Definition: Variations.h:139
unsigned int getSpecularColorRed() const
Gets the specular red value.
const std::string & getDiffuseHueMetadataName() const
Gets the diffuse hue metadata name.
void setSpecularEccentricity(float value)
Sets the specular eccentricity.
void setSpecularColorRed(const int red)
Sets the specular red value.
void setSpecularWeight(float value)
Sets the specular weight.
Variation override class.
Definition: Variations.h:427
VariationOverride(AgentTypeVariationCPtr agentTypeVariation, const VariationOverride &vg)
Constructor.
const std::vector< std::string > & getGeometryFilters() const
Get all geometry filters.
Definition: Variations.h:453
unsigned int numGeometryFilter() const
Gets the number of geometry filters.
Definition: Variations.h:435
void addGeometryFilter(const std::string &geometryName)
Adds a geometry filter.
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
Variation Tree Geo class.
Definition: Variations.h:500
Variation Tree class.
Definition: Variations.h:580
const VariationTreeGeoMap & getVariationTypes() const
get the variation types
Definition: Variations.h:596
void addGeoMatAliases(const std::string &geo, const std::string &mat)
add geo mat aliases
const std::vector< std::pair< std::string, std::string > > & getGeoMatAliases() const
get geo mat aliases
Definition: Variations.h:632
const MaterialConstraintMap & getMaterialConstraints() const
get the material constraints
Definition: Variations.h:605
VariationTree(AgentTypeVariationCPtr agentTypeVariation, const VariationTree &variationTree)
Constructor.
VariationTree(AgentTypeVariationCPtr agentTypeVariation)
Constructor.
Definition: Variations.h:584
const std::pair< std::string, std::string > & getGeoMatSuffixReplacement() const
get geo mat suffix replacement
Definition: Variations.h:626
const VariationTreeGeoMap & getExtraGeos() const
get the extra geos
Definition: Variations.h:602
void setGeoMatSuffixReplacement(const std::string &geo, const std::string &mat)
set geo mat suffix replacement
Definition: Variations.h:623
const ExcludeGeometryMap & getExcludeGeometries() const
get the exclude geometries
Definition: Variations.h:608
void setMaterialPrefix(const std::string &materialPrefix)
add geo mat aliases
Definition: Variations.h:635
bool hasVariationType(const std::string &name) const
has variation type
Definition: Variations.h:599
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
std::vector< std::pair< std::string, std::string > > build(const std::string &variationType, unsigned agentSeed, unsigned int seed, std::vector< std::string > &debugMessages, const bool storeDebugMessages=false) const
build variation method
const std::string & getMaterialPrefix() const
get material prefix
Definition: Variations.h:638
~VariationTree()
Destructor.
Definition: Variations.h:590
Variations class.
Definition: Variations.h:839
void hash(AtomsCore::MurmurHash3 &hasher) const
Hash.
bool hasAgentTypeVariation(const std::string &agentTypeName)
Checks if an agent type variation exists.
Definition: Variations.h:864
AgentTypeVariation & getAgentTypeVariation(const std::string &agentTypeName)
Gets an agent type variation.
Definition: Variations.h:855
bool writeToFile(const std::string &filePath)
Write the agent variations map to a file.
~Variations()
Destructor.
Definition: Variations.h:846
std::string toString(const bool prettyprint=false)
Converts the agent variations map to a string.
Variations()
Constructor.
Definition: Variations.h:843
void setAgentTypeVariation(const std::string &agentTypeName, const AgentTypeVariation &atv)
Sets an agent type variation.
Definition: Variations.h:858
void clear()
Removes the agents variations.
Definition: Variations.h:849
Definition: Hash.h:23
Atoms namespace.
Definition: Agent.h:29
AgentTypeVariation * AgentTypeVariationPtr
agent type variation pointer
Definition: Variations.h:35
const VariationTreeGeo * VariationTreeGeoCPtr
variation tree geo pointer
Definition: Variations.h:53
const VariationOverride * VariationOverrideCPtr
variation override const pointer
Definition: Variations.h:49
const VariationTree * VariationTreeCPtr
variation tree pointer
Definition: Variations.h:52
VariationGeometry * VariationGeometryPtr
variation geometry pointer
Definition: Variations.h:36
VariationMaterialColor * VariationMaterialColorPtr
variation material color pointer
Definition: Variations.h:41
const VariationMaterialColor * VariationMaterialColorCPtr
variation material color const pointer
Definition: Variations.h:51
const Variations * VariationsCPtr
variations const pointer
Definition: Variations.h:44
VariationMaterial * VariationMaterialPtr
variation material pointer
Definition: Variations.h:37
Variations * VariationsPtr
variations pointer
Definition: Variations.h:32
VariationOverride * VariationOverridePtr
variation override pointer
Definition: Variations.h:39
const VariationMaterial * VariationMaterialCPtr
variation material const pointer
Definition: Variations.h:47
const VariationGroupLod * VariationGroupLodCPtr
variation group lod const pointer
Definition: Variations.h:50
VariationGroupLod * VariationGroupLodPtr
variation group lod pointer
Definition: Variations.h:40
VariationGroup * VariationGroupPtr
variation group pointer
Definition: Variations.h:38
const AgentTypeVariation * AgentTypeVariationCPtr
agent type const pointer
Definition: Variations.h:45
const VariationGroup * VariationGroupCPtr
variation group const pointer
Definition: Variations.h:48
const VariationGeometry * VariationGeometryCPtr
variation geometry const pointer
Definition: Variations.h:46
VariationTree * VariationTreePtr
variation tree pointer
Definition: Variations.h:42