/usr/include/opencollada/COLLADAFramework/COLLADAFWMeshVertexData.h is in opencollada-dev 0.1.0~20140703.ddf8f47+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | /*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of COLLADAFramework.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __COLLADAFW_MESHINPUTS_H__
#define __COLLADAFW_MESHINPUTS_H__
#include "COLLADAFWPrerequisites.h"
#include "COLLADAFWArrayPrimitiveType.h"
#include "COLLADAFWFloatOrDoubleArray.h"
#include <assert.h>
namespace COLLADAFW
{
/** Base class for mesh input elements, like positions, normals, colors, texcoord, ... */
class MeshVertexData : public FloatOrDoubleArray
{
public:
/**
* Additional informations about multiple inputs.
*/
struct InputInfos
{
String mName;
size_t mStride;
size_t mLength;
};
typedef ArrayPrimitiveType<InputInfos*> InputInfosArray;
private:
/** Array with additional informations about multiple input elements. */
InputInfosArray mInputInfosArray;
public:
/** Constructor. */
MeshVertexData ()
: FloatOrDoubleArray()
, mInputInfosArray (0)
{}
/** Constructor. */
MeshVertexData ( DataType type )
: FloatOrDoubleArray(type)
, mInputInfosArray (0)
{}
/** Destructor. */
virtual ~MeshVertexData()
{
for ( size_t i=0; i<mInputInfosArray.getCount(); ++i )
{
delete mInputInfosArray [i];
}
mInputInfosArray.releaseMemory ();
}
/**
* Returns the number of uv sets.
*/
size_t getNumInputInfos () const { return mInputInfosArray.getCount (); }
/** Returns the InputInfosArray.*/
const InputInfosArray& getInputInfosArray() const { return mInputInfosArray; }
/**
* Appends the values in the array on the list of values and stores the information
* of the current input.
* @param const FloatArray& valuesArray The list of values.
* @param const String& name The name of the current element.
* @param const size_t stride The data stride.
*/
void appendValues ( const FloatArray& valuesArray, const String& name, const size_t stride )
{
setType ( DATA_TYPE_FLOAT );
FloatOrDoubleArray::appendValues ( valuesArray );
InputInfos* info = new InputInfos();
info->mLength = valuesArray.getCount ();
info->mName = name;
info->mStride = stride;
mInputInfosArray.append ( info );
}
/**
* Appends the values in the array on the list of values and stores the information
* of the current input.
* @param const FloatArray& valuesArray The list of values.
* @param const String& name The name of the current element.
* @param const size_t stride The data stride.
*/
void appendValues ( const DoubleArray& valuesArray, const String& name, const size_t stride )
{
setType ( DATA_TYPE_DOUBLE );
FloatOrDoubleArray::appendValues ( valuesArray );
InputInfos* info = new InputInfos();
info->mLength = valuesArray.getCount ();
info->mName = name;
info->mStride = stride;
mInputInfosArray.append ( info );
}
/** The stride at the specified index. */
String getName ( size_t index ) const
{
COLLADABU_ASSERT ( index <= mInputInfosArray.getCount() );
if ( index >= mInputInfosArray.getCount () ) return 0;
return mInputInfosArray[index]->mName;
}
/** The stride at the specified index. */
size_t getStride ( size_t index ) const
{
COLLADABU_ASSERT ( index <= mInputInfosArray.getCount() );
if ( index >= mInputInfosArray.getCount () ) return 0;
return mInputInfosArray[index]->mStride;
}
/** The stride can differ, so we have to set. */
size_t getLength ( size_t index ) const
{
COLLADABU_ASSERT ( index <= mInputInfosArray.getCount() );
if ( index >= mInputInfosArray.getCount () ) return 0;
return mInputInfosArray[index]->mLength;
}
/** Appends the values of the input array to the end of values array.
The programmer must ensure, that the memory allocated,
was large enough to hold another element. No new memory is allocated.*/
bool appendValues ( const FloatArray& valuesArray )
{
return FloatOrDoubleArray::appendValues ( valuesArray );
}
/** Appends the values of the input array to the end of values array.
The programmer must ensure, that the memory allocated,
was large enough to hold another element. No new memory is allocated.*/
bool appendValues ( const DoubleArray& valuesArray )
{
return FloatOrDoubleArray::appendValues ( valuesArray );
}
private:
/** Disable default copy ctor. */
MeshVertexData( const MeshVertexData& pre );
/** Disable default assignment operator. */
const MeshVertexData& operator= ( const MeshVertexData& pre );
};
} // namespace COLLADAFW
#endif // __COLLADAFW_MESHINPUTS_H__
|