10 #include <AtomsCore/AtomsMath.h>
11 #include <Atoms/Globals.h>
12 #include <Atoms/AgentGroup.h>
13 #include <AtomsCore/Metadata/Vector3Metadata.h>
60 enum GlobalRotationMode
62 kRotationPositionAndDirection = 0,
74 kScalePositionAndAgent = 0,
80 kAverageOrientation = 0,
111 enum AgentGroupSelectionMode
134 inline void setMode(
unsigned short mode) { m_mode = mode; m_falloffDirty =
true;}
135 inline unsigned short mode() {
return m_mode; }
137 inline void setRotationAxis(
unsigned short mode) { m_rotationAxis = mode; }
138 inline unsigned short rotationAxis() {
return m_rotationAxis; }
140 inline void setAgentMode(
unsigned short mode) { m_agentMode = mode; }
141 inline unsigned short agentMode() {
return m_agentMode; }
143 inline void setAgentGroupSelectionMode(
unsigned short mode) { m_agentGroupSelectionMode = mode; }
144 inline unsigned short agentGroupSelectionMode() {
return m_agentGroupSelectionMode; }
146 inline void setLayout(
unsigned short layout) { m_layout = layout; generateSamples(); }
147 inline unsigned short layout() {
return m_layout; }
149 inline void setUseHeightFields(
bool val) { m_useHeightFields = val; }
150 inline short useHeightFields() {
return m_useHeightFields; }
152 inline void setMoveSpace(
bool val) { m_moveSpace = val; }
153 inline short moveSpace() {
return m_moveSpace; }
155 inline void setRotationSpace(
bool val) { m_rotationSpace = val; }
156 inline short rotationSpace() {
return m_rotationSpace; }
158 inline void setGlobalRotationMode(
unsigned short val) { m_globalRotationMode = val; }
159 inline short globalRotationMode() {
return m_globalRotationMode; }
161 inline void setScaleSpace(
bool val) { m_scaleSpace = val; }
162 inline short scaleSpace() {
return m_scaleSpace; }
164 inline void setGlobalScaleMode(
unsigned short val) { m_globalScaleMode = val; }
165 inline short globalScaleMode() {
return m_globalScaleMode; }
167 inline void setRandomSelected(
bool val) { m_randomSelected = val; }
168 inline bool randomSelected() {
return m_randomSelected; }
170 inline void setUpVector(
short val) { m_upVector = val; }
171 inline short upVector() {
return m_upVector; }
173 inline void setSelectedObjects(std::vector<std::string>& obList) { m_selectedObjects = obList; }
174 inline std::vector<std::string>& selectedObjects() {
return m_selectedObjects; }
176 inline void setTargetObjects(std::vector<std::string>& obList) { m_targetObjects = obList; }
177 inline std::vector<std::string>& targetObjects() {
return m_targetObjects; }
179 inline void setAgentTypes(std::vector<std::string>& agentTypes) { m_agentTypes = agentTypes; }
180 inline std::vector<std::string>& agentTypes() {
return m_agentTypes; }
182 inline void setAgentTypeWeights(std::vector<int>& weights) { m_agentTypeWeights = weights; }
183 inline std::vector<int>& agentTypeWeights() {
return m_agentTypeWeights; }
185 std::string agentType();
187 inline bool translateLockX() {
return m_translateLockX; }
188 inline bool translateLockY() {
return m_translateLockY; }
189 inline bool translateLockZ() {
return m_translateLockZ; }
191 inline void setTranslateLockX(
bool val) { m_translateLockX = val; }
192 inline void setTranslateLockY(
bool val) { m_translateLockY = val; }
193 inline void setTranslateLockZ(
bool val) { m_translateLockZ = val; }
195 inline bool rotateLockX() {
return m_rotateLockX; }
196 inline bool rotateLockY() {
return m_rotateLockY; }
197 inline bool rotateLockZ() {
return m_rotateLockZ; }
199 inline void setRotateLockX(
bool val) { m_rotateLockX = val; }
200 inline void setRotateLockY(
bool val) { m_rotateLockY = val; }
201 inline void setRotateLockZ(
bool val) { m_rotateLockZ = val; }
203 inline bool scaleLockX() {
return m_scaleLockX; }
204 inline bool scaleLockY() {
return m_scaleLockY; }
205 inline bool scaleLockZ() {
return m_scaleLockZ; }
207 inline void setScaleLockX(
bool val) { m_scaleLockX = val; }
208 inline void setScaleLockY(
bool val) { m_scaleLockY = val; }
209 inline void setScaleLockZ(
bool val) { m_scaleLockZ = val; }
214 inline void setDirectionRandom(
const AtomsCore::Vector3& val) { m_directionRandom = val; }
217 inline void setGridSize(
const AtomsCore::Vector3i& val) { m_gridSize = val; generateSamples();}
220 inline void setGridSpace(
const AtomsCore::Vector3& val) { m_gridSpace = val; generateSamples();}
223 inline void setGridSpaceRandom(
const AtomsCore::Vector3& val) { m_gridSpaceRandom = val; generateSamples();}
232 inline void setPoissonRadius(
double val) { m_poissonRadius = val; generateSamples();}
233 inline double poissonRadius() {
return m_poissonRadius; }
235 inline void setPoissonMinDistance(
double val) { m_poissonMinDistance = val; generateSamples();}
236 inline double poissonMinDistance() {
return m_poissonMinDistance; }
238 inline void setPoissonNumPoints(
int val) { m_poissonPoints = val; generateSamples(); }
239 inline int poissonNumPoints() {
return m_poissonPoints; }
241 inline void setPoissonSeed(
int val) { m_poissonSeed = val; generateSamples(); }
242 inline int poissonSeed() {
return m_poissonSeed; }
244 inline void setPoissonShape(
short val) { m_poissonShape = val; generateSamples(); }
245 inline short poissonShape() {
return m_poissonShape; }
247 inline void setDrawScale(
double value) { m_drawScale = value; }
248 inline double drawScale() {
return m_drawScale; }
250 inline bool timeOffsetGroupAgents() {
return m_timeOffsetGroupAgents; }
251 inline void setTimeOffsetGroupAgents(
const bool value) { m_timeOffsetGroupAgents = value; }
253 inline const std::string &copiedVariationName(
const std::string &agentType) {
return m_copiedVariationName[agentType]; }
254 inline void setCopiedVariationName(
const std::string &agentType,
const std::string &name) { m_copiedVariationName[agentType] = name; }
256 inline const bool falloffEnabled() {
return m_falloffEnabled; }
257 inline void setFalloffEnabled(
const bool value) { m_falloffEnabled = value; m_falloffDirty =
true; }
259 inline const double falloffRadius() {
return m_falloffRadius; }
260 inline void setFalloffRadius(
const double value) { m_falloffRadius = value; m_falloffDirty =
true; }
262 inline void setFalloffMode(
const unsigned int mode) { m_falloffMode = mode; }
263 inline const unsigned int falloffMode() {
return m_falloffMode; }
265 inline void clearFalloffDirty() { m_falloffDirty =
false; }
266 inline bool falloffDirty() {
return m_falloffDirty; }
267 inline void markFalloffDirty() { m_falloffDirty =
true; }
269 virtual void generateSamples();
271 inline std::vector<AtomsCore::Vector3> cachedSamples() {
return m_cachedSamples; }
272 inline void setCachedSamples(std::vector<AtomsCore::Vector3>& samples) { m_cachedSamples = samples; }
274 void agentSelectionChanged();
276 virtual void reset();
278 inline void setJointModeAgentGroupId(
size_t mode) { m_jointModeAgentId = mode; }
279 inline size_t jointModeAgentGroupId() {
return m_jointModeAgentId; }
281 inline void setJointModeJointId(
int mode) { m_jointModeJointId = mode; }
282 inline int jointModeJointId() {
return m_jointModeJointId; }
284 inline void setJointModeGroupIndex(
int index) { m_jointModeGroupIndex = index; }
285 inline int jointModeGroupIndex() {
return m_jointModeGroupIndex; }
287 inline double polyMinRadius() {
return m_polyMinRadius; };
288 inline double polyMaxRadius() {
return m_polyMaxRadius; };
289 inline int polyNumAgents() {
return m_polyNumAgents; };
290 inline int polyIterations() {
return m_polyIterations; };
291 inline int polySeed() {
return m_polySeed; };
292 inline bool polyRandom() {
return m_polyRandom; };
294 inline void setPolyMinRadius(
double value) { m_polyMinRadius = value; m_polyHash++; };
295 inline void setPolyMaxRadius(
double value) { m_polyMaxRadius = value; m_polyHash++; };
296 inline void setPolyNumAgents(
int value) { m_polyNumAgents = value; m_polyHash++; };
297 inline void setPolyIterations(
int value) { m_polyIterations = value; m_polyHash++;};
298 inline void setPolySeed(
int value) { m_polySeed = value; m_polyHash++;};
299 inline void setPolyRandom(
bool value) { m_polyRandom = value; m_polyHash++;};
300 inline long polyHash() {
return m_polyHash; }
302 inline void setDuplicateAgentGroupIds(
const std::string groupName,
const int id1,
const int id2) { m_agentDuplicateIds[groupName][id1] = id2; };
303 inline void resetDuplicateAgentGroupIds() { m_agentDuplicateIds.clear(); };
304 int getDuplicateAgentGroupIds(
const std::string &groupName,
const int id);
306 inline SocialLayoutMode socialLayoutMode() {
return m_socialLayoutMode; };
307 inline void setSocialLayoutMode(SocialLayoutMode mode) { m_socialLayoutMode = mode; };
308 inline std::vector<int> &getSocialAgentIds() {
return m_socialAgentIds; }
309 inline std::vector<AtomsCore::Vector3> &socialAgentPositions() {
return m_socialAgentPositions; }
310 inline std::vector<AtomsCore::Vector3> &socialAgentDirections() {
return m_socialAgentDirections; }
311 inline std::vector<AtomsCore::Quaternion> &socialAgentRotations() {
return m_socialAgentRotations; }
312 inline AtomsCore::Vector3 &socialAveragePosition() {
return m_socialAgentsAveragePosition; }
313 inline AtomsCore::Vector3 &socialAverageDirection() {
return m_socialAgentsAverageDirection; }
314 inline AtomsCore::Vector3 &socialReferencePosition() {
return m_socialReferencePosition; }
315 inline void setSocialReferencePosition(
const AtomsCore::Vector3 &pos) { m_socialReferencePosition = pos; }
316 inline std::vector<int> &socialGroupSizes() {
return m_socialGroupSizes; }
318 inline void setDisplayTimeOffsetBarOnScreenBottom(
const bool value) { m_displayTimeOffsetBarOnScreenBottom = value; }
319 inline bool displayTimeOffsetBarOnScreenBottom() {
return m_displayTimeOffsetBarOnScreenBottom; }
321 inline void setSocialSeparationForce(
double value) { m_socialSeparationForce = value; };
322 inline void setSocialSeparationRadius(
double value) { m_socialSeparationRadius = value; };
323 inline void setSocialDistanceNoise(
const AtomsCore::Vector3 &value) { m_socialDistanceNoise = value; };
324 inline void setSocialOrientationNoise(
const AtomsCore::Vector3 &value) { m_socialOrientationNoise = value; };
325 inline double socialSeparationRadius() {
return m_socialSeparationRadius; };
326 inline double socialSeparationForce() {
return m_socialSeparationForce; };
327 inline const AtomsCore::Vector3& socialDistanceNoise() {
return m_socialDistanceNoise; };
328 inline const AtomsCore::Vector3& socialOrientationNoise() {
return m_socialOrientationNoise; };
329 inline const std::vector<AtomsCore::Vector3> &socialFinalDirections() {
return m_socialFinalDirections; };
330 inline const std::vector<AtomsCore::Vector3> &socialFinalPositions() {
return m_socialFinalPositions; };
331 inline void setSocialFinalDirections(
const std::vector<AtomsCore::Vector3> &value) { m_socialFinalDirections = value; };
332 inline void setSocialFinalPositions(
const std::vector<AtomsCore::Vector3> &value) { m_socialFinalPositions = value; };
334 inline void setMeshScatterIterations(
const int value) { m_meshScatterIterations = value; }
335 inline void setMeshScatterDefaultRadius(
const double value) { m_meshScatterDefaultRadius = value; }
336 inline void setMeshScatterMaxRadius(
const double value) { m_meshScatterMaxRadius = value; }
337 inline void setMeshScatterSeed(
const int value) { m_meshScatterSeed = value; }
338 inline void setMeshScatterMode(
const int value) { m_meshScatterMode = value; }
339 inline void setRandRadius(
const bool value) { m_meshScatterRandRadius = value; }
340 inline void setMeshScatterMesh(
const AtomsUtils::Mesh &mesh) { m_meshScatterMesh = mesh; }
341 inline int meshScatterIterations() {
return m_meshScatterIterations; }
342 inline double meshScatterDefaultRadius() {
return m_meshScatterDefaultRadius; }
343 inline double meshScatterMaxRadius() {
return m_meshScatterMaxRadius; }
344 inline int meshScatterSeed() {
return m_meshScatterSeed; }
345 inline int meshScatterMode() {
return m_meshScatterMode; }
346 inline bool meshRandRadius() {
return m_meshScatterRandRadius; }
348 int getSocialIndex(
const int id)
const;
350 void initSocialLayoutData(
const std::vector<Atoms::AgentGroup *> &agentGroups);
351 void editAgentsWithSocialValue(
double value);
353 static void searchAgents(
const std::vector<Atoms::AgentGroup * > &agentGroups,
const bool useSearchRadius,
const double searchRadius,
const bool ignoreOneAgent,
const bool usePercentage,
const int percentage,
const bool useAgentType,
const std::vector<std::string> &agentTypeNames,
const bool useMetadata,
const std::string &metadataName,
const double metadataMin,
const double metadataMax,
const std::string& metadataStrValue, std::vector<std::vector<int>> &selection);
356 inline void setApplyPelvisHeightOffset(
bool val) { m_applyPelvisHeightOffset = val; }
357 inline bool applyPelvisHeightOffset() {
return m_applyPelvisHeightOffset; }
361 void cachePelvisTransformation(
const std::vector<Atoms::AgentGroup *> &agentGroups);
363 bool computeHeightField(
Atoms::Agent *agent,
AtomsCore::Poser &poser,
Atoms::HeightField *hf,
Atoms::HeightField *gf,
AtomsCore::Vector3 &jointRootWorldTranlsate,
AtomsCore::Quaternion &jointRootWorldRotation,
AtomsCore::Vector3 &jointRootWorldScale,
AtomsCore::Vector3f &currPose,
AtomsCore::Vector3 &agentUp, AtomsPtr<AtomsCore::Vector3Metadata> &upVec,
double &pelvisHeight,
bool useHeightFields);
364 void findModules(
const AtomsPtr<Atoms::AgentGroup> &agentGroup,
bool &isPointLayout,
bool &isCacheReader, std::string ¤tModuleName);
366 unsigned short m_mode;
368 unsigned short m_layout;
370 unsigned short m_agentMode;
371 unsigned short m_agentGroupSelectionMode;
373 unsigned short m_globalRotationMode;
374 unsigned short m_globalScaleMode;
376 unsigned short m_rotationAxis;
378 bool m_useHeightFields;
380 bool m_randomSelected;
382 bool m_timeOffsetGroupAgents;
387 bool m_translateLockX;
388 bool m_translateLockY;
389 bool m_translateLockZ;
400 short m_rotationSpace;
403 bool m_displayTimeOffsetBarOnScreenBottom;
415 std::map<std::string, std::map<int, int>> m_agentDuplicateIds;
417 double m_poissonRadius;
418 double m_poissonMinDistance;
419 double m_poissonPoints;
420 short m_poissonShape;
421 unsigned int m_poissonSeed;
422 std::string m_poissonMask;
424 std::map<std::string, std::string> m_copiedVariationName;
428 std::vector<std::string> m_agentTypes;
429 std::vector<int> m_agentTypeWeights;
431 std::vector<std::string> m_selectedObjects;
433 std::vector<std::string> m_targetObjects;
435 std::vector<AtomsCore::Vector3> m_cachedSamples;
437 size_t m_jointModeAgentId;
439 int m_jointModeJointId;
440 int m_jointModeGroupIndex;
442 bool m_falloffEnabled;
443 double m_falloffRadius;
445 unsigned short m_falloffMode;
447 double m_polyMinRadius;
448 double m_polyMaxRadius;
450 int m_polyIterations;
456 std::vector<int> m_socialAgentIds;
457 std::vector<int> m_socialGroupSizes;
458 std::vector<AtomsCore::Vector3> m_socialAgentPositions;
459 std::vector<AtomsCore::Vector3> m_socialAgentDirections;
460 std::vector<AtomsCore::Quaternion> m_socialAgentRotations;
461 std::vector<AtomsCore::Vector3> m_agentRandomOffsetDistances;
462 std::vector<AtomsCore::Vector3> m_agentRandomOffsetDirections;
463 std::vector<std::string> m_socialAgentGroupNames;
467 std::vector<AtomsCore::Vector3> m_socialFinalPositions;
468 std::vector<AtomsCore::Vector3> m_socialFinalDirections;
469 SocialLayoutMode m_socialLayoutMode;
473 double m_socialSeparationForce;
474 double m_socialSeparationRadius;
478 int m_meshScatterIterations;
479 double m_meshScatterDefaultRadius;
480 double m_meshScatterMaxRadius;
481 int m_meshScatterSeed;
482 int m_meshScatterMode;
483 bool m_meshScatterRandRadius;
488 bool m_applyPelvisHeightOffset;
Agent.
Definition: Agent.h:44
Container for all agent types.
Definition: HeightField.h:17
Poser class.
Definition: Poser.h:24
Definition: KdTreePoint.h:19
Mesh class.
Definition: Mesh.h:30
AtomsMath::Vector3i Vector3i
Vector3i class.
Definition: AtomsMath.h:59
AtomsMath::Quaternion Quaternion
Quaternion class.
Definition: AtomsMath.h:67
AtomsMath::Vector3 Vector3
Vector3 class.
Definition: AtomsMath.h:57
AtomsMath::Vector3f Vector3f
Vector3 class.
Definition: AtomsMath.h:58
Atoms namespace.
Definition: Agent.h:29
AtomsPtr< const AgentType > AgentTypeCPtr
Agent type const pointer.
Definition: AgentType.h:21