//------------------------------------------------------------------- void Vob::readUnpacked(ZenArchive* _zenArchive, ushort _version) { setPresetName(_zenArchive->readString("presetName")); // Read bounding box (with the world space coordinates). // It's very possible the bounding box will not been used // because Ogre prefers to calculate bounds by itself. float bbox3DWS[6]; _zenArchive->readRawFloat("bbox3DWS", bbox3DWS, sizeof(bbox3DWS)); AxisAlignedBox bbox( (Real) bbox3DWS[0], (Real) bbox3DWS[1], (Real) bbox3DWS[2], (Real) bbox3DWS[3], (Real) bbox3DWS[4], (Real) bbox3DWS[5]); setWorldBounds(exchangeYZ(bbox)); // read transformation matrix Matrix3 rot = _zenArchive->readMatrix3("trafoOSToWSRot"); Vector3 pos = _zenArchive->readVector3("trafoOSToWSPos"); setDerivedPosition(exchangeYZ(pos)); setDerivedOrientation(exchangeYZ(rot)); setName(_zenArchive->readString("vobName")); setVisual(_zenArchive->readString("visual")); setShowVisual(_zenArchive->readBool("showVisual")); setVisualCamAlign( (VisualCamAlign::Enum) _zenArchive->readEnum("visualCamAlign") ); setCdStatic(_zenArchive->readBool("cdStatic")); setCdDyn(_zenArchive->readBool("cdDyn")); setStaticVob(_zenArchive->readBool("staticVob")); setDynShadow( (DynShadow::Enum) _zenArchive->readEnum("dynShadow") ); }
//-------------------------------------------------------------------------------------------------- phdClip::phdClip(phdGenBase * _visual) { setVisual(_visual); setCropArea(0.0, 0.0, 1.0, 1.0); setDrawArea(0.0, 0.0, sizeX, sizeY); setIsVisual(true); setup(); }
NFishSwarm::NFishSwarm(ParamMap & v):PopulationCont<CodeVReal, NFish>(v[param_popSize],v[param_evalCountFlag]),m_tryNumber(2),m_limit(0.75),\ m_bestLastEnvir(GET_NUM_DIM,Global::msp_global->mp_problem->getNumObj()){ setVisual(CAST_PROBLEM_CONT->getSearchRange().getDomainSize()/4); m_flag.resize(3); m_flag[NFishSwarm::f_sleeping]=m_flag[NFishSwarm::f_est_s]=m_flag[NFishSwarm::f_excl]=false; }
//------------------------------------------------------------------- void Vob::readPacked(ZenArchive* _zenArchive, ushort _version) { PackedVob packedVob; size_t sz = _zenArchive->readRaw("dataRaw", &packedVob, sizeof(packedVob)); if(sz == 0x53) { // Gothic 2 } else if(sz == 0x4A) { // Gothic 1 old format: flags occupy two bytes, visualAnimModeStrength // and vobFarClipZScale are not used packedVob.flags[3] = 0; packedVob.visualAniModeStrength = 0; packedVob.vobFarClipZScale = 1; } else { // Unknown format GOTHOGRE_EXCEPT("Vob: Unexpected dataRaw size: " << sz); } Vector3 pos( (Real) packedVob.pos[0], (Real) packedVob.pos[1], (Real) packedVob.pos[2] ); Matrix3 rot( (Real) packedVob.rot[0], (Real) packedVob.rot[1], (Real) packedVob.rot[2] , (Real) packedVob.rot[3], (Real) packedVob.rot[4], (Real) packedVob.rot[5] , (Real) packedVob.rot[6], (Real) packedVob.rot[7], (Real) packedVob.rot[8] ); setDerivedPosition(exchangeYZ(pos)); setDerivedOrientation(exchangeYZ(rot)); AxisAlignedBox bbox( (Real) packedVob.bbox3DWS[0], (Real) packedVob.bbox3DWS[1], (Real) packedVob.bbox3DWS[2], (Real) packedVob.bbox3DWS[3], (Real) packedVob.bbox3DWS[4], (Real) packedVob.bbox3DWS[5]); setWorldBounds(exchangeYZ(bbox)); PackedVobBits bits; memset(&bits, 0, sizeof(bits)); memcpy(&bits, &packedVob.flags, sizeof(packedVob.flags)); if(bits.presetName) setPresetName(_zenArchive->readString("presetName")); if(bits.vobName) setName(_zenArchive->readString("vobName")); if(bits.visual) setVisual(_zenArchive->readString("visual")); setShowVisual(bits.showVisual); setVisualCamAlign( (VisualCamAlign::Enum) bits.visualCamAlign); setCdStatic(bits.cdStatic); setCdDyn(bits.cdDyn); setStaticVob(bits.staticVob); setDynShadow( (DynShadow::Enum) bits.dynShadow); }
/** * Constructor. * @param tag * @param model */ RigidBody::RigidBody(const string tag, Visual* model) { setTag(tag); setVisual(model); shape_ = NULL; body_ = NULL; mass_ = 1.0f; friction_ = 1.0f; motionState_ = new btDefaultMotionState( btTransform(btQuaternion(0,0,0,1), btVector3(0,0,0)) ); }
NFishSwarm::NFishSwarm(int size,bool flag):PopulationCont<CodeVReal, NFish>(size,flag),m_tryNumber(2),m_limit(0.75),\ m_bestLastEnvir(GET_NUM_DIM,Global::msp_global->mp_problem->getNumObj()){ setVisual(CAST_PROBLEM_CONT->getSearchRange().getDomainSize()/4); m_flag.resize(3); m_flag[0]=m_flag[1]=m_flag[2]=false; }
const Visual &Option::getVisual() { if (appearances.count() == 0) setVisual(value); return appearances; }