File: FCDGeometry.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 (126 lines) | stat: -rw-r--r-- 4,832 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
	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 FCDGeometry.h
	This file contains the FCDGeometry class.
	The FCDGeometry class holds the information for one mesh or spline
	entity, within the COLLADA geometry library.
*/
#ifndef _FCD_GEOMETRY_H_
#define _FCD_GEOMETRY_H_

#ifndef _FCD_ENTITY_H_
#include "FCDocument/FCDEntity.h"
#endif // _FCD_ENTITY_H_
#ifndef _FU_DAE_ENUM_H_
#include "FUtils/FUDaeEnum.h"
#endif // _FU_DAE_ENUM_H_

class FCDocument;
class FCDGeometryMesh;
class FCDGeometrySpline;

/**
	@defgroup FCDGeometry COLLADA Document Geometry Entity
	@addtogroup FCDocument
*/

/**
	A COLLADA geometry entity.
	There are three types of COLLADA geometry entities: meshes, NURBS surfaces and splines.
	*NURBS Surfaces are part of the Premium Build only.*

	Meshes are collections of polygons where the vertices always have a position,
	usually have a normal to define smooth or hard edges and may be colored or textured.

	Parameterized surfaces (PSurface) are a list of parameterized patches defined as a sequence of 
	weighted control points that may be associated with two knot vectors
	and possibly trimming curves to define a 3D surface.

	Note: "PSurfaces" are part of the Premium Build only.

	Splines are a sequence of control points used to generate a smooth curve.

	@ingroup FCDGeometry
*/

class FCOLLADA_EXPORT FCDGeometry : public FCDEntity
{
private:
	DeclareObjectType(FCDEntity);

	// Contains only one of the following, in order of importance.
	DeclareParameterRef(FCDGeometryMesh, mesh, FC("Mesh"));
	DeclareParameterRef(FCDGeometrySpline, spline, FC("Spline"));

public:
	/** Contructor: do not use directly.
		Create new geometries using the FCDLibrary::AddEntity function.
		@param document The COLLADA document which owns the new geometry entity. */
	FCDGeometry(FCDocument* document);

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

	/**	[INTERNAL] Set geometry information.
		@param data The specific geometry data structure.
	*/
	void SetMesh(FCDGeometryMesh* data){ mesh = data; }
	void SetSpline(FCDGeometrySpline* data){ spline = data; } /** see above */

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

	/** Retrieves whether the type of this geometry is a mesh.
		@return Whether this geometry is a mesh. */
	bool IsMesh() const { return mesh != NULL; }

	/** Retrieves the mesh information structure for this geometry.
		Verify that this geometry is a mesh using the IsMesh function prior to calling this function.
		@return The mesh information structure. This pointer will be NULL when the geometry is a spline or is undefined. */
	FCDGeometryMesh* GetMesh() { return mesh; }
	const FCDGeometryMesh* GetMesh() const { return mesh; } /**< See above. */

	/** Sets the type of this geometry to mesh and creates an empty mesh structure.
		This function will release any mesh or spline structure that the geometry may already contain
		@return The mesh information structure. This pointer will always be valid. */
	FCDGeometryMesh* CreateMesh();

	/** Retrieves whether the type of this geometry is a spline.
		@return Whether this geometry is a spline. */
	bool IsSpline() const { return spline != NULL; }

	/** Retrieves the spline information structure for this geometry.
		Verify that this geometry is a spline using the IsSpline function prior to calling this function.
		@return The spline information structure. This pointer will be NULL when the geometry is a mesh or is undefined. */
	FCDGeometrySpline* GetSpline() { return spline; }
	const FCDGeometrySpline* GetSpline() const { return spline; } /**< See above. */

	/** Sets the type of this geometry to spline and creates an empty spline structure.
		This function will release any mesh or spline structure that the geometry may already contain.
		@return The spline information structure. This pointer will always be valid. */
	FCDGeometrySpline* CreateSpline();


	/** Retrieves whether the type of this geometry is a parameterized surface.
		@return Whether this geometry is a parameterized surface. */
	bool IsPSurface() const { return false; }

	/** Copies the geometry entity into a clone.
		The clone may reside in another document.
		@param clone The empty clone. If this pointer is NULL, a new geometry entity
			will be created and you will need to release the returned pointer manually.
		@param cloneChildren Whether to recursively clone this entity's children.
		@return The clone. */
	virtual FCDEntity* Clone(FCDEntity* clone = NULL, bool cloneChildren = false) const;
};

#endif // _FCD_GEOMETRY_H_