File: FCDPhysicsModelInstance.h

package info (click to toggle)
0ad 0.0.23.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,292 kB
  • sloc: cpp: 245,166; ansic: 200,249; python: 13,754; sh: 6,104; perl: 4,620; makefile: 977; xml: 810; java: 533; ruby: 229; erlang: 46; pascal: 30; sql: 21; tcl: 4
file content (111 lines) | stat: -rw-r--r-- 4,541 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
	Copyright (C) 2005-2007 Feeling Software Inc.
	Portions of the code are:
	Copyright (C) 2005-2007 Sony Computer Entertainment America
	
	MIT License: http://www.opensource.org/licenses/mit-license.php
*/

/**
	@file FCDPhysicsModelInstance.h
	This file contains the FCDPhysicsModelInstance class.
*/

#ifndef _FCD_PHYSICS_MODEL_ENTITY_H_
#define _FCD_PHYSICS_MODEL_ENTITY_H_

#ifndef _FCD_ENTITY_INSTANCE_H_
#include "FCDocument/FCDEntityInstance.h"
#endif // _FCD_ENTITY_INSTANCE_H_

class FCDocument;
class FCDForceField;
class FCDPhysicsForceFieldInstance;
class FCDPhysicsRigidBody;
class FCDPhysicsRigidBodyInstance;
class FCDPhysicsRigidConstraint;
class FCDPhysicsRigidConstraintInstance;

/**
	A COLLADA physics model instance.

	@ingroup FCDocument
*/
class FCOLLADA_EXPORT FCDPhysicsModelInstance : public FCDEntityInstance
{
private:
	DeclareObjectType(FCDEntityInstance);
	
	DeclareParameterContainer(FCDEntityInstance, instances, FC("Inner Instances"));

public:
	/** Constructor: do not use directly. Create new physics models using the 
		FCDPhysicsModel::AddPhysicsModelInstance function.
		@param document The COLLADA document that contains this physics model
			instance. */
	FCDPhysicsModelInstance(FCDocument* document);

	/** Destructor. */
	virtual ~FCDPhysicsModelInstance();

	/** Retrieves the entity type for this class. This function is part of the 
		FCDEntity interface.
		@return The entity type: PHYSICS_MODEL. */
	virtual Type GetType() const { return FCDEntityInstance::PHYSICS_MODEL; }

	/** Retrieves all the instances from this physics model instance.
		@return The instances. */
	DEPRECATED(3.05A, GetInstanceCount and GetInstance(index)) void GetInstances() const {}

	/** Retrieves the number of instances from this physics model instance.
		@return The number of instances. */
	size_t GetInstanceCount() const { return instances.size(); }

	/** Retrieves a specified instance from this physics model instance by 
		index.
		@param index The index.
		@return The instance. */
	FCDEntityInstance* GetInstance(size_t index) { FUAssert(index < GetInstanceCount(), return NULL); return instances.at(index); }
	const FCDEntityInstance* GetInstance(size_t index) const { FUAssert(index < GetInstanceCount(), return NULL); return instances.at(index); } /**< See above. */

	/** Adds an instantiated rigid body to this physics model instance.
		@param rigidBody The rigid body to be instanced in this physics model
			instance. If this value is NULL, then there is no associated 
			rigid body for the instance yet. It should be filled in.
		@return The new rigid body instance. */
	FCDPhysicsRigidBodyInstance* AddRigidBodyInstance(FCDPhysicsRigidBody* rigidBody = NULL);

	/** Adds an instantiated rigid constraint to this physics model instance.
		@param rigidConstraint The rigid constraint to be instanced in this 
			physics model instance. If this value is NULL, then there is no 
			associated rigid constraint for the instance yet. It should be 
			filled in.
		@return The new rigid constraint instance. */
	FCDPhysicsRigidConstraintInstance* AddRigidConstraintInstance(FCDPhysicsRigidConstraint* rigidConstraint = NULL);

	/** Adds an instantiated force field to this physics model instance.
		@param forceField The force field to be instanced in this physics model
			instance. If this value is NULL, then there is no associated 
			force field for the instance yet. It should be filled in.
		@return The new force field instance. */
	FCDPhysicsForceFieldInstance* AddForceFieldInstance(FCDForceField* forceField = NULL);

	/** Removes and deletes the instance from the model.
		@param instance The instance to remove. 
		@return True if the instance was removed. */
	DEPRECATED(3.05A, instance->Release() or SAFE_RELEASE(instance)) bool RemoveInstance(FCDEntityInstance* instance);

	/** Copies the physics model instance into a clone.
		@param clone The empty clone. If this pointer is NULL, a new physics 
			model instance will be created and you will need to release the 
			returned pointer manually.
		@return The clone. */
	virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const;

	/** [INTERNAL] Cleans up the sub identifiers.
		The sub identifiers must be unique with respect to its parent. This method corrects the sub ids if there are conflicts.
		@param parentStringMap The string map from the parent of this instance in which the sub ids must be unique. */
	virtual void CleanSubId(FUSUniqueStringMap* parentStringMap);
};

#endif // _FCD_PHYSICS_MODEL_ENTITY_H_