source: NonGTP/FCollada/FCDocument/FCDPhysicsParameter.hpp @ 964

Revision 964, 1.7 KB checked in by igarcia, 18 years ago (diff)
Line 
1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5
6#include "StdAfx.h"
7#include "FCDocument/FCDocument.h"
8#include "FUtils/FUDaeWriter.h"
9using namespace FUDaeWriter;
10
11template <class T>
12FCDPhysicsParameter<T>::FCDPhysicsParameter(FCDocument* document, const string& ref) : FCDPhysicsParameterGeneric(document, ref)
13{
14        value = NULL;
15}
16
17template <class T>
18FCDPhysicsParameter<T>::~FCDPhysicsParameter()
19{
20        SAFE_DELETE(value);
21}
22
23// Clone
24template <class T>
25FCDPhysicsParameterGeneric* FCDPhysicsParameter<T>::Clone()
26{
27        FCDPhysicsParameterGeneric *clone = new FCDPhysicsParameter<T>(GetDocument(), reference);
28        ((FCDPhysicsParameter<T>*)clone)->value = new T(*value);
29        return clone;
30}
31
32template <class T>
33void FCDPhysicsParameter<T>::SetValue(T val)
34{
35        if(value)
36        {
37                SAFE_DELETE(value);
38        }
39        value = new T();
40        *value = val;
41}
42
43
44template <class T>
45void FCDPhysicsParameter<T>::SetValue(T* val)
46{
47        if(value)
48        {
49                SAFE_DELETE(value);
50        }
51        value = val;
52}
53
54// Flattening: overwrite the target parameter with this parameter
55template <class T>
56void FCDPhysicsParameter<T>::Overwrite(FCDPhysicsParameterGeneric* target)
57{
58        ((FCDPhysicsParameter<T>*) target)->SetValue(value);
59}
60
61/*
62// Parse in this Collada parameter from the xml node tree
63template <class T>
64FUStatus FCDPhysicsParameter<T>::LoadFromXML(xmlNode* parameterNode)
65{
66        FUStatus status;
67        return status;
68}
69*/
70// Write out this ColladaFX parameter to the xml node tree
71template <class T>
72xmlNode* FCDPhysicsParameter<T>::WriteToXML(xmlNode* parentNode) const
73{
74        xmlNode* parameterNode = FUXmlWriter::AddChild(parentNode, reference.c_str());
75        //TODO: complete
76        return parameterNode;
77}
Note: See TracBrowser for help on using the repository browser.