Physics::Physics() { m_GlobalProps["GRAVITY"] = Prop(IPhysics::VEC4, 0.0f, 9.8f, 0.0f, 0.0f); m_GlobalProps["K"] = Prop(IPhysics::FLOAT, 0.1f); m_MaterialProps["ACCELERATION"] = Prop(IPhysics::VEC4, 1.0f, 0.0f, 0.0f, 0.0f); m_MaterialProps["MASS"] = Prop(IPhysics::FLOAT, 1.0f); m_MaterialProps["MASS1"] = Prop(IPhysics::FLOAT, 1.0f); }
QList<Prop> DurationElement::properties(Xml& xml, bool /*clipboardmode*/) const { QList<Prop> pl = Element::properties(xml); if (tuplet()) pl.append(Prop("Tuplet", tuplet()->id())); return pl; }
UProperty* FindStrictScriptVariable( UStruct* InStruct, const TCHAR* PropName) { guard(FindStrictScriptVariable); FName NAME_PropName = FName( PropName, FNAME_Find); check( NAME_PropName != NAME_None ); for( TStrictFieldIterator<UProperty> Prop( InStruct ); Prop; ++Prop ) if( Prop->GetFName() == NAME_PropName ) return *Prop; appThrowf( (TEXT("Property not found in %s!!"), InStruct->GetName() ) ); return NULL; unguardf( (PropName) ); }
void CEditCombinationProp::SetProp( const EFFECT_PROP* pProp, int32 nBufLen ) { EVector<EFFECT_PROP> Prop( pProp, pProp + nBufLen ); CEditUnitPropHelp::SetBaseProp( Prop ); for ( size_t i = 0; i < Prop.size(); ++i ) { if( Prop[i].Name() == "特效文件" ) m_strEffectFileName = Prop[i].Data().Str(); if( Prop[i].Name() == "特效名" ) m_nEffectIndex = Prop[i].Data().Index(); } _UpdateParams(); }
void Control::updateProp(float deltaTime,Map &m) { //TODO a random generator of props on the map and check if is interacting with a NPC //TODO a random generator of props on the map //TODO a random generator of props on the map for (unsigned int i = 0; i < props.size(); ++i) { if (!props[i].empty()) npcOnProp(i); while (props[i].size() < 1 and std::rand()%10 == 0) { int x,y; x = std::rand() % COLS; y = std::rand() % ROWS; if (m.isWalkeable(sf::Vector2f(x,y))) { Prop p = Prop(Star+i,sf::Vector2f(x,y),TILE_SIZE); props[i].push_back(p); } } } }
void init(){ // scene.getLight(0).setOn(false); scene.getLight(0).setDiffuse(GeomColor(255,255,255,50)); SceneLight &l = scene.getLight(1); static Camera cam(Vec(0,0,600,1), Vec(0,0,-1,1), Vec(0,-1,0,1)); cam.setResolution(Size(1024,1024)); scene.setGravity(Vec(0,0,-1000)); l.setShadowCam(new Camera(cam)); l.setShadowEnabled(true); l.setAnchorToWorld(); l.setPosition(Vec(0,0,600,1)); l.setOn(true); l.setSpecularEnabled(true); l.setDiffuseEnabled(true); l.setSpecular(GeomColor(0,100,255,255)); l.setDiffuse(GeomColor(255,100,0,30)); scene.setPropertyValue("shadows.use improved shading",true); scene.setPropertyValue("shadows.resolution",2048); scene.setPropertyValue("shadows.bias",10); //static const int W=20,H=13,DIM=W*H; static const int W=pa("-paper-dim",0), H=pa("-paper-dim",1); static Img8u frontFace = load<icl8u>(*pa("-ff")); static Img8u backFace = load<icl8u>(*pa("-bf")); const Size s(210,297); const Vec corners[4] = { Vec(-s.width/2, -s.height/2, 150,1), Vec(s.width/2, -s.height/2, 150,1), Vec(s.width/2, s.height/2, 150,1), Vec(-s.width/2, s.height/2, 150,1), }; paper = new ManipulatablePaper(&scene,&scene,W,H,corners,true,&frontFace,&backFace); //scene.removeObject(paper); //paper->addShadow(-74.5); if(pa("-o")){ std::vector<Camera> cams; for(int i=0;i<3;++i){ cams.push_back(Camera(*pa("-c",i))); } capturer = new SceneMultiCamCapturer(scene, cams); // Scene::enableSharedOffscreenRendering(); scene.setDrawCamerasEnabled(false); } gui << Draw3D(Size::VGA).minSize(32,24).handle("draw") << (VBox().maxSize(12,100).minSize(12,1) << ( HBox() << Fps(10).handle("fps") << Button("add clutter").handle("add") ) << ( HBox() << Button("stopped","running",true).out("run") << Button("paper ...").handle("props") ) << ( HBox() << CheckBox("show cubes").out("showCubes") << CheckBox("show texture",false).out("showTexture") << CheckBox("show links",false).out("showLinks") ) << FSlider(0,1,0.5).out("vertexMoveFactor").label("manual force") << FSlider(1,100,10).out("attractorStreangth").label("attractor force") << FSlider(0.0001,0.9999,0.9).handle("globalStiffness").label("global paper stiffness") << ( HBox() << Button("reset paper").handle("resetPaper") << Combo("1,5,10,25,!200,300,500").handle("maxFPS").label("max FPS") ) << FSlider(0.1,20,2).handle("cm").label("collision margin") << ( HBox() << Button("memorize").handle("mem") << CheckBox("soften with mouse",true).handle("soften") << Button("test").handle("pct") ) ) << Show(); propGUI << Prop("paper").minSize(16,1).maxSize(16,100) << Create(); gui["pct"].registerCallback(paper_coords_test); gui["props"].registerCallback(utils::function((GUI&)propGUI,&GUI::switchVisibility)); gui["resetPaper"].registerCallback(reset_paper); gui["globalStiffness"].registerCallback(change_global_stiffness); scene.PhysicsWorld::addObject(&ground); scene.Scene::addObject(&groundVis); DrawHandle3D draw = gui["draw"]; draw->install(paper->createMouseHandler(0)); draw->install(&foldLine); draw->link(scene.getGLCallback(0)); foldLine.cb = utils::function(fold_line_cb); }
void MorphGeometry::updateMorph(void) { if(!getBaseGeometry()) { SWARNING << "No Base Geometry" << std::endl; return; } for(UInt32 i(0) ; i<getMFMorphProperties()->size() ; ++i) { GeoVectorProperty* BaseProp(getBaseGeometry()->getProperty(getMorphProperties(i))); GeoVectorPropertyUnrecPtr Prop(getProperty(getMorphProperties(i))); switch(getBlendingMethod()) { case Relative: { //Reset the Base mesh UInt32 NumBytesToCopy(Prop->getFormatSize() * BaseProp->size() * BaseProp->getDimension()); memcpy(Prop->editData(), BaseProp->getData(), NumBytesToCopy); } break; default: SWARNING << "Invalid blending method: " << getBlendingMethod() << ". Using Normalized method." << std::endl; case Normalized: { Real32 Weight(1.0f); for(UInt32 j(0) ; j < getNumMorphTargets() ; ++j) { Weight -= osgAbs(getMorphTargetWeight(j)); } //Zero out the property zeroGeoProperty(Prop); //Call the morph property with the given property format morphGeoProperty(BaseProp, Prop, Weight); } break; } setProperty(Prop, getMorphProperties(i)); //Loop through all morph targets Geometry* Target; GeoVectorProperty* TargetProp; Real32 Weight; for(UInt32 j(0) ; j < getNumMorphTargets() ; ++j) { //If the Weight is really small then don't apply it Weight = osgAbs(getMorphTargetWeight(j)); if(Weight < 0.000001f) { continue; } Target = getMorphTarget(j); TargetProp = Target->getProperty(getMorphProperties(i)); //Call the morph property with the given property format morphGeoProperty(TargetProp, Prop, Weight); } } }
void init(){ gui << Prop("a").label("properties of a") << Prop("a").label("also properties of a") << Prop("c").label("properties of c only") << Show(); }
int CDittoRulerRichEditCtrl::SaveToDB(BOOL bUpdateDesc) { int nRet = FALSE; if(m_SaveTypes == stNONE && m_lID >= 0) { return DIDNT_NEED_TO_SAVE; } if(m_rtf.GetModify() == FALSE) { Log(_T("Clip has not been modified")); return DIDNT_NEED_TO_SAVE; } bool bSetModifyToFalse = true; try { CClip Clip; Clip.m_id = m_lID; if(m_SaveTypes & stRTF) { LoadRTFData(Clip); } if(m_SaveTypes & stCF_TEXT || m_SaveTypes & stCF_UNICODETEXT) { LoadTextData(Clip); } if(Clip.m_Formats.GetSize() <= 0) { return FALSE; } theApp.m_db.execDML(_T("begin transaction;")); if(m_lID >= 0) { Clip.SaveFromEditWnd(bUpdateDesc); } else { bSetModifyToFalse = false; Clip.MakeLatestOrder(); CCopyProperties Prop(-1, this, &Clip); Prop.SetHandleKillFocus(true); Prop.SetToTopMost(false); if(Prop.DoModal() == IDOK) { Clip.AddToDB(); m_csDescription = Clip.m_Desc; m_lID = Clip.m_id; bUpdateDesc = TRUE; bSetModifyToFalse = true; } } nRet = SAVED_CLIP_TO_DB; theApp.m_db.execDML(_T("commit transaction;")); if(bUpdateDesc) theApp.RefreshView(); } CATCH_SQLITE_EXCEPTION if(bSetModifyToFalse) m_rtf.SetModify(FALSE); return nRet; }