sergey.pozhidaev Posted November 14, 2014 Share Posted November 14, 2014 hi, i need to integrate my vector types with Unigine-script vector types(vec3, vec4, etc.). the main idea is : 1. define in my vector class some conversion functions to unigine vector types (copy ctor, operator=, type conversion operator) class dVec3 { ... #ifdef UNIGINE_VERSION inline dVec3(const Unigine::dvec3 &v) { this->x = v.x; this->y = v.y; this->z = v.z; } operator Unigine::dvec3() const { return Unigine::dvec3(x, y, z); } #endif ... } 2. define some VariableToType <> and TypeToVariable <> templates DECLARE_VARIABLE_TO_TYPE(GlobeXY::dVec3, GlobeXY::dVec3, getDVec3, ); DECLARE_VARIABLE_TO_TYPE(const GlobeXY::dVec3 &, GlobeXY::dVec3, getDVec3, ); DECLARE_TYPE_TO_VARIABLE_REF(GlobeXY::dVec3, setDVec3, ); DECLARE_TYPE_TO_VARIABLE_STACK(const GlobeXY::dVec3 &, setDVec3, ); 3. all seems to be well, except the #undef DECLARE_VARIABLE_TO_TYPE #undef DECLARE_TYPE_TO_VARIABLE_REF #undef DECLARE_TYPE_TO_VARIABLE_STACK in UnigineInterpreter.h i think you have to remove this #undefs for ability to do things like this without copy-paste this defines to user code. Link to comment
silent Posted November 14, 2014 Share Posted November 14, 2014 Hi, Please, check the attached sample. Just unpack it into <SDK>/source/samples/Api/Scripts directory and build. This sample will be available in the next SDK update. Thanks! Types.zip How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts