1 /* 2 * MFVec4f.h 3 * 4 * Copyright (C) 1999 Stephen F. White, 2009 J. "MUFTI" Scheurich 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program (see the file "COPYING" for details); if 18 * not, write to the Free Software Foundation, Inc., 675 Mass Ave, 19 * Cambridge, MA 02139, USA. 20 */ 21 22 #pragma once 23 24 #include "MFFloat.h" 25 #include "Vec4f.h" 26 27 class MFVec2f; 28 29 class MFVec4f : public MFFloat { 30 public: MFVec4f()31 MFVec4f() : MFFloat() {} MFVec4f(int size)32 MFVec4f(int size) : MFFloat(size * 4) {} MFVec4f(const MFVec4f * values)33 MFVec4f(const MFVec4f *values) : 34 MFFloat(values->getValues(), values->getSize()) {} MFVec4f(const float * values,int len)35 MFVec4f(const float *values, int len) : 36 MFFloat(values, len) {} MFVec4f(const double * values,int len)37 MFVec4f(const double *values, int len) : 38 MFFloat(values, len) {} 39 40 MFVec4f(MFVec2f *mfVec2f); 41 getType()42 virtual int getType() const { return MFVEC4F; } getTypeName()43 virtual const char *getTypeName() const { return "MFVec4f"; } getStride()44 virtual int getStride() const { return 4; } 45 virtual FieldValue *copy(); 46 47 virtual bool readLine(int index, char *line); 48 49 virtual bool equals(const FieldValue *value) const; 50 51 virtual FieldValue *getSFValue(int index) const; 52 virtual void setSFValue(int index, FieldValue *value); 53 virtual void setSFValue(int index, const float *values); 54 virtual void setSFValue(int index, float x, float y, float z, 55 float w); 56 getValue(int index)57 const float *getValue(int index) const 58 { return m_value.getData() + index * 4; } 59 60 void setVec(int index, Vec4f v); 61 Vec4f getVec(int index); 62 63 virtual void insertSFValue(int index, FieldValue *value); 64 virtual void insertSFValue(int index, const float *values); 65 virtual void insertSFValue(int index, float x, float y, float z, 66 float w); 67 appendSFValue(float x,float y,float z,float w)68 virtual void appendSFValue(float x, float y, float z, float w) 69 { insertSFValue(getSFSize(), x, y, z, w); } 70 71 Vec4f getMinBoundingBox(void); 72 Vec4f getMaxBoundingBox(void); 73 74 void flip(int index); 75 void swap(int fromTo); 76 77 MyString getEcmaScriptComment(MyString name, int flags) const; 78 supportAnimation(bool x3d)79 bool supportAnimation(bool x3d) const { return true; } 80 81 randomFunction(MFVec4f) 82 }; 83