|
Blender
V2.59
|
00001 /* 00002 * VectorValue.h: interface for the CVectorValue class. 00003 * $Id: VectorValue.h 35063 2011-02-22 10:33:14Z jesterking $ 00004 * Copyright (c) 1996-2000 Erwin Coumans <coockie@acm.org> 00005 * 00006 * Permission to use, copy, modify, distribute and sell this software 00007 * and its documentation for any purpose is hereby granted without fee, 00008 * provided that the above copyright notice appear in all copies and 00009 * that both that copyright notice and this permission notice appear 00010 * in supporting documentation. Erwin Coumans makes no 00011 * representations about the suitability of this software for any 00012 * purpose. It is provided "as is" without express or implied warranty. 00013 * 00014 */ 00015 00020 #if !defined _VECTORVALUE_H 00021 #define _VECTORVALUE_H 00022 00023 #include "Value.h" 00024 00025 #define KX_X 0 00026 #define KX_Y 1 00027 #define KX_Z 2 00028 00029 00030 class CVectorValue : public CPropValue 00031 { 00032 //PLUGIN_DECLARE_SERIAL(CVectorValue,CValue) 00033 00034 public: 00035 //void Transform(rcMatrix4x4 mat); 00036 virtual void SetValue(CValue* newval); 00037 void SetVector(double newvec[]); 00038 void Configure(CValue* menuvalue); 00039 virtual double* GetVector3(bool bGetTransformedVec=false); 00040 virtual double GetNumber(); 00041 00042 CValue* Calc(VALUE_OPERATOR op, CValue *val) { 00043 return val->CalcFinal(VALUE_VECTOR_TYPE, op, this); 00044 } 00045 00046 CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val); 00047 00048 00049 CVectorValue(double vec[],const char *name,AllocationTYPE alloctype=CValue::HEAPVALUE); 00050 CVectorValue() {}; 00051 00052 CVectorValue(double vec[],AllocationTYPE alloctype=CValue::HEAPVALUE); 00053 CVectorValue(float x,float y,float z, AllocationTYPE alloctype = CValue::HEAPVALUE); 00054 virtual ~CVectorValue(); 00055 //virtual bool ExportT3D(File *txtfile,bool bNoName=false); 00056 void AddConfigurationData(CValue* menuvalue); 00057 00058 00059 00060 virtual CValue* GetReplica(); 00061 virtual const STR_String & GetText(); 00062 00063 /* 00064 void SnapPoint(float num,int snap) 00065 { 00066 if (num > 0) num += ((float)snap / 2); 00067 else num -= ((float)snap / 2); 00068 num = (long)(((long)(num / snap)) * snap); 00069 }; 00070 00071 void SnapPosition(const double snapvec[]) 00072 { 00073 00074 if (snapvec[KX_X] >= 1) 00075 SnapPoint(m_vec[KX_X],snapvec[KX_X]); 00076 if (snapvec[KX_Y] >= 1) 00077 SnapPoint(m_vec[KX_Y],snapvec[KX_Y]); 00078 if (snapvec[KX_Z] >= 1) 00079 SnapPoint(m_vec[KX_Z],snapvec[KX_Z]); 00080 00081 } 00082 */ 00083 00084 protected: 00085 double m_vec[3]; 00086 double m_transformedvec[3]; 00087 00088 00089 #ifdef WITH_CXX_GUARDEDALLOC 00090 public: 00091 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:CVectorValue"); } 00092 void operator delete( void *mem ) { MEM_freeN(mem); } 00093 #endif 00094 }; 00095 00096 #endif // !defined _VECTORVALUE_H 00097