void TwoDepthImageAlignerNode::Relation::serialize(ObjectData& data, IdContext& context) { MapNodeBinaryRelation::serialize(data,context); data.setPointer("aligner", _aligner); data.setPointer("converter", _converter); data.setPointer("currentSensingFrame", _currentSensingFrame); data.setPointer("referenceSensingFrame", _referenceSensingFrame); data.setString("topic", _topic); data.setInt("inliers", _inliers); data.setFloat("error", _error); }
Variant f_get_called_class() { if (hhvm) { CallerFrame cf; ActRec* ar = cf(); if (ar == NULL) { return Variant(false); } if (ar->hasThis()) { ObjectData* obj = ar->getThis(); return obj->o_getClassName(); } else if (ar->hasClass()) { return ar->getClass()->preClass()->name()->data(); } else { return Variant(false); } } else { CStrRef cls = FrameInjection::GetStaticClassName( ThreadInfo::s_threadInfo.getNoCheck()); return cls.size() ? Variant(cls.get()) : Variant(false); } }
void TwoDepthImageAlignerNode::Relation::deserialize(ObjectData& data, IdContext& context) { MapNodeBinaryRelation::deserialize(data,context); data.getReference("aligner").bind(_aligner); data.getReference("converter").bind(_converter); data.getReference("currentSensingFrame").bind(_currentSensingFrame); data.getReference("referenceSensingFrame").bind(_referenceSensingFrame); _topic = data.getString("topic"); _inliers = data.getInt("inliers"); _error = data.getFloat("error"); }
//--------------------------------------------------------------------- void ObjectMemoryManager::applyRebase( ArrayMemoryManager::ManagerType managerType, uint16 level, const MemoryPoolVec &newBasePtrs, const ArrayMemoryManager::PtrdiffVec &diffsList ) { ObjectData objectData; const size_t numObjs = this->getFirstObjectData( objectData, level ); for( size_t i=0; i<numObjs; i += ARRAY_PACKED_REALS ) { for( size_t j=0; j<ARRAY_PACKED_REALS; ++j ) { if( objectData.mOwner[j] ) { objectData.mIndex = j; objectData.mOwner[j]->_getObjectData() = objectData; } } objectData.advancePack(); } }
void objOffsetSet(TypedValue* base, CVarRef offset, TypedValue* val, bool validate /* = true */) { if (validate) { objArrayAccess(base); } static StringData* sd__offsetSet = StringData::GetStaticString("offsetSet"); ObjectData* obj = base->m_data.pobj; if (LIKELY(obj->isInstance())) { Instance* instance = static_cast<Instance*>(obj); const Func* method = instance->methodNamed(sd__offsetSet); ASSERT(method != NULL); TypedValue tvResult; tvWriteUninit(&tvResult); instance->invokeUserMethod(&tvResult, method, CREATE_VECTOR2(offset, tvAsCVarRef(val))); tvRefcountedDecRef(&tvResult); } else { tvAsVariant(base).getArrayAccess() ->o_invoke(sd__offsetSet, CREATE_VECTOR2(offset, tvAsCVarRef(val))); } }
TypedValue* objOffsetGet(TypedValue& tvRef, TypedValue* base, CVarRef offset, bool validate /* = true */) { if (validate) { objArrayAccess(base); } TypedValue* result; ObjectData* obj = base->m_data.pobj; if (LIKELY(obj->isInstance())) { Instance* instance = static_cast<Instance*>(obj); static StringData* sd__offsetGet = StringData::GetStaticString("offsetGet"); const Func* method = instance->methodNamed(sd__offsetGet); ASSERT(method != NULL); instance->invokeUserMethod(&tvRef, method, CREATE_VECTOR1(offset)); result = &tvRef; } else { tvAsVariant(&tvRef) = tvAsVariant(base).getArrayAccess()->___offsetget_lval(offset); result = &tvRef; } return result; }
ArrayIter getArrayIterHelper(const Variant& v, size_t& sz) { if (v.isArray()) { ArrayData* ad = v.getArrayData(); sz = ad->size(); return ArrayIter(ad); } if (v.isObject()) { ObjectData* obj = v.getObjectData(); if (obj->isCollection()) { sz = collections::getSize(obj); return ArrayIter(obj); } bool isIterable; Object iterable = obj->iterableObject(isIterable); if (isIterable) { sz = 0; return ArrayIter(iterable.detach(), ArrayIter::noInc); } } SystemLib::throwInvalidArgumentExceptionObject( "Parameter must be an array or an instance of Traversable"); }
void renderObject ( glm::mat4 MVP, int index ) { //upload the matrix to the shader glUniformMatrix4fv(loc_mvpmat, 1, GL_FALSE, glm::value_ptr(MVP)); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, objectsDataList.getTexture(index)); //set up the Vertex Buffer Object so it can be drawn glEnableVertexAttribArray(loc_position); glEnableVertexAttribArray(loc_uv); glEnableVertexAttribArray(loc_normal); glBindBuffer(GL_ARRAY_BUFFER, objectsDataList.getVBO(index)); //set pointers into the vbo for each of the attributes(position and color) glVertexAttribPointer( loc_position,//location of attribute 3,//number of elements GL_FLOAT,//type GL_FALSE,//normalized? sizeof(Vertex),//stride 0);//offset // for uv data glVertexAttribPointer( loc_uv, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, uv)); // for normal data glVertexAttribPointer( loc_normal, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, normal)); glDrawArrays(GL_TRIANGLES, 0, objectsDataList.getTriangles(index));//mode, starting index, count }
void GUIMainWindow::OnRecalcBtClick(wxCommandEvent& event) { //Ist ein Objekt geladen? if (wxGetApp().getCurrentDataObjectIndex() > -1) { //das aktive Objekt ObjectData* obj = wxGetApp().getActiveObject(); //Speichern der Objekteigenschaften assignCurrentObjectProps(); //neuberechnen der Temperaturverteilung obj->calculateIO(); //aktualisieren des 3D-Fensters gl_context->refresh(); //Objekteigenschaften aktuell propbox->getUpToDateLbl()->Hide(); //evtl. Analysedatenübersicht aktualisieren if (analyze_window_valid) { analyzerframe->Update(); } } }
void cleanUp() { // Clean up, Clean up int counter; for(counter = 0; counter < globalObjCount; counter++) { objectsDataList.dealocateObject(counter); } glDeleteProgram(program); glDeleteBuffers(1, &vbo_geometry); }
void resetGame() { float dt; start = std::chrono::high_resolution_clock::now(); scoreOne = 1000; cout << "globalObjCount" << globalObjCount << endl; // reset items for (int index = 0; index < globalObjCount; index++) { // if on the puck if ( index != 0 ) { btVector3 startPos; if (objectsDataList.getRigidBody(index) && objectsDataList.getRigidBody(index)->getMotionState()) { btTransform puckTrans; puckTrans.setIdentity(); if ( index == 1 ) { startPos = btVector3(-5.0f, -3.0f, -5.0f); } puckTrans.setOrigin(startPos); btDefaultMotionState* puckMotionState = new btDefaultMotionState(puckTrans); objectsDataList.getRigidBody(index)->setMotionState(puckMotionState); objectsDataList.getRigidBody(index)->setLinearVelocity(btVector3(0.0f, 0.0f, 0.0f)); objectsDataList.getRigidBody(index)->setAngularVelocity(btVector3(0,0,0)); } } } dt = getDT(); dynamicsWorld->stepSimulation(dt, 10.0f); }
MStatus ObjectParameterHandler::doSetValue( IECore::ConstParameterPtr parameter, MPlug &plug ) const { IECore::ConstObjectParameterPtr p = IECore::runTimeCast<const IECore::ObjectParameter>( parameter ); if( !p ) { return MS::kFailure; } // Keep trying all the available handlers until we find one that works. /// \todo Investigate whether we can do a parameter->getValue() here and just get the handler which represents it for (IECore::ObjectParameter::TypeIdSet::const_iterator it = p->validTypes().begin(); it != p->validTypes().end(); ++it) { ConstParameterHandlerPtr h = ParameterHandler::create( *it ); if (h) { if ( h->doSetValue( parameter, plug) ) { return MS::kSuccess; } } } MStatus s; MFnPluginData fnData; MObject plugData = fnData.create( ObjectData::id ); assert( plugData != MObject::kNullObj ); s = fnData.setObject( plugData ); assert(s); ObjectData* data = dynamic_cast<ObjectData *>( fnData.data(&s) ); assert(s); assert(data); data->setObject( p->getValue()->copy() ); return plug.setValue( plugData ); }
/////////////////////////////////////// // human interaction functions below // // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv/// void movePlayerOnePad (int x, int y) { btRigidBody* tempRB = objectsDataList.getRigidBody(1); btVector3 tempVec3; tempVec3 = tempRB->getLinearVelocity(); int xValue = 0; int yValue = 0; int zValue = 0; int topFourth = h / 4; int bottomFourth = topFourth * 3; int leftFourth = w / 4; int rightFourth = leftFourth * 3; if ( x < leftFourth ) { xValue += 5; xValue = xValue + tempVec3.getX(); if(xValue > 15) xValue = 15; } if ( x > rightFourth ) { xValue -= 5; xValue = xValue + tempVec3.getX(); if(xValue < -15) xValue = -15; } if ( y < topFourth ) { zValue += 5; zValue = zValue + tempVec3.getZ(); if(zValue > 15) zValue = 15; } if ( y > bottomFourth ) { zValue -= 5; zValue = zValue + tempVec3.getZ(); if(zValue < -15) zValue = -15; } tempRB->setLinearVelocity(btVector3(xValue, yValue , zValue)); }
ALWAYS_INLINE typename std::enable_if< std::is_base_of<BaseMap, TMap>::value, Object>::type BaseMap::php_differenceByKey(const Variant& it) { if (!it.isObject()) { SystemLib::throwInvalidArgumentExceptionObject( "Parameter it must be an instance of Iterable"); } ObjectData* obj = it.getObjectData(); TMap* target = BaseMap::Clone<TMap>(this); auto ret = Object::attach(target); if (obj->isCollection()) { if (isMapCollection(obj->collectionType())) { auto map = static_cast<BaseMap*>(obj); auto* eLimit = map->elmLimit(); for (auto* e = map->firstElm(); e != eLimit; e = nextElm(e, eLimit)) { if (e->hasIntKey()) { target->remove((int64_t)e->ikey); } else { assert(e->hasStrKey()); target->remove(e->skey); } } return ret; } } for (ArrayIter iter(obj); iter; ++iter) { Variant k = iter.first(); if (k.isInteger()) { target->remove(k.toInt64()); } else { assert(k.isString()); target->remove(k.getStringData()); } } return ret; }
bool ArrayData::hasInternalReference(PointerSet &vars, bool ds /* = false */) const { if (isSharedMap()) return false; for (ArrayIter iter(this); iter; ++iter) { CVarRef var = iter.secondRef(); if (var.isReferenced()) { Variant *pvar = var.getVariantData(); if (vars.find(pvar) != vars.end()) { return true; } vars.insert(pvar); } if (var.isObject()) { ObjectData *pobj = var.getObjectData(); if (vars.find(pobj) != vars.end()) { return true; } vars.insert(pobj); if (pobj->o_instanceof("Serializable")) { if (ds) { // We want to detect Serializable object as well return true; } else { // Serializable object does not have internal reference issue return false; } } if (pobj->o_toArray().get()->hasInternalReference(vars, ds)) { return true; } } else if (var.isArray() && var.getArrayData()->hasInternalReference(vars, ds)) { return true; } } return false; }
Variant ArrayIter::firstHelper() { if (hasVector()) { return m_pos; } if (hasMap()) { assert(m_pos != 0); c_Map* mp = getMap(); if (UNLIKELY(m_versionNumber != mp->getVersionNumber())) { throw_collection_modified(); } return mp->iter_key(m_pos); } if (hasStableMap()) { assert(m_pos != 0); c_StableMap* smp = getStableMap(); if (UNLIKELY(m_versionNumber != smp->getVersionNumber())) { throw_collection_modified(); } return smp->iter_key(m_pos); } assert(hasObject()); ObjectData* obj = getObject(); return obj->o_invoke(s_key, Array()); }
Status PlaybackManager::save( Object* o ) { ObjectData* data = o->data(); data->setLooping( mIsLooping ); data->setRangedPlayback( mIsRangedPlayback ); data->setMarkInFrameNumber( mMarkInFrame ); data->setMarkOutFrameNumber( mMarkOutFrame ); data->setFrameRate( mFps ); return Status::OK; }
void ManifoldVoronoiExtractor::deserialize(ObjectData& data, IdContext& context) { StreamProcessor::deserialize(data,context); data.getReference("manager").bind(_manager); data.getReference("cache").bind(_cache); _resolution = data.getFloat("resolution"); _xSize = data.getInt("xSize"); _ySize = data.getInt("ySize"); _normalThreshold = data.getFloat("normalThreshold"); _dequeSize = data.getInt("dequeSize"); }
void ManifoldVoronoiExtractor::serialize(ObjectData& data, IdContext& context) { StreamProcessor::serialize(data,context); data.setPointer("manager", _manager); data.setPointer("cache", _cache); data.setFloat("resolution", _resolution); data.setInt("xSize", _xSize); data.setInt("ySize", _ySize); data.setFloat("normalThreshold", _normalThreshold); data.setInt("dequeSize", _dequeSize); }
void myMouse(int button, int state, int x, int y) { if(button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) { cout << "Left Button Pressed" << endl; btRigidBody* tempRB = objectsDataList.getRigidBody(1); btVector3 tempVec3; int xValue = 0; int yValue = 0; int zValue = 0; int topFourth = h / 4; int bottomFourth = topFourth * 3; int leftFourth = w / 4; int rightFourth = leftFourth * 3; // move up if ( y < topFourth ) { zValue += 15; } // move down if ( y > bottomFourth ) { zValue -= 15; } // move left if ( x < leftFourth ) { xValue += 15; } // move rith if ( x > rightFourth ) { xValue -= 15; } tempVec3 = tempRB->getLinearVelocity(); tempRB->setLinearVelocity(btVector3(xValue + tempVec3.getX(), yValue + tempVec3.getY(), zValue + tempVec3.getZ())); } }
static Variant f_hphp_get_iterator(VRefParam iterable, bool isMutable) { if (iterable.isArray()) { if (isMutable) { return create_object(s_MutableArrayIterator, CREATE_VECTOR1(ref(iterable))); } return create_object(s_ArrayIterator, CREATE_VECTOR1(iterable)); } if (iterable.isObject()) { ObjectData *obj = iterable.getObjectData(); Variant iterator; while (obj->instanceof(SystemLib::s_IteratorAggregateClass)) { iterator = obj->o_invoke(s_getIterator, Array()); if (!iterator.isObject()) break; obj = iterator.getObjectData(); } VM::Class*ctx = g_vmContext->getContextClass(); CStrRef context = ctx ? ctx->nameRef() : empty_string; if (isMutable) { if (obj->instanceof(SystemLib::s_IteratorClass)) { throw FatalErrorException("An iterator cannot be used for " "iteration by reference"); } Array properties = obj->o_toIterArray(context, true); return create_object(s_MutableArrayIterator, CREATE_VECTOR1(ref(properties))); } else { if (obj->instanceof(SystemLib::s_IteratorClass)) { return obj; } return create_object(s_ArrayIterator, CREATE_VECTOR1(obj->o_toIterArray(context))); } } raise_warning("Invalid argument supplied for iteration"); if (isMutable) { return create_object(s_MutableArrayIterator, CREATE_VECTOR1(Array::Create())); } return create_object(s_ArrayIterator, CREATE_VECTOR1(Array::Create())); }
void update() { //cout << "Makes it to update!" << endl; float dt = getDT(); int counter; // pass dt to all objects and let them update themselves based on their // current flags/status //cout << "Gets to before stepsim" << endl; dynamicsWorld->stepSimulation(dt, 10.0f); //cout << "GLOBAL COUNT" << globalObjCount << endl; for (counter = 0; counter < globalObjCount; counter++) { objectsDataList.updateObject(counter); } // Update the state of the scene glutPostRedisplay();//call the display callback }
//--Implementations void render() { //cout << "Makes it to Render!" << endl; int counter; //clear the screen glClearColor(0.2, 0.2, 0.2, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //enable the shader program glUseProgram(program); for(counter = 0; counter < globalObjCount; counter++) { //matrix MVP for planet mvp = projection * view * objectsDataList.getModelMatrix(counter); // load each objects mvp renderObject( mvp, counter ); } //swap the buffers glutSwapBuffers(); }
bool f_is_callable(CVarRef v, bool syntax /* = false */, VRefParam name /* = null */) { bool ret = true; if (LIKELY(!syntax)) { CallerFrame cf; ObjectData* obj = NULL; HPHP::Class* cls = NULL; StringData* invName = NULL; const HPHP::Func* f = vm_decode_function(v, cf(), false, obj, cls, invName, false); if (f == NULL) { ret = false; } if (invName != NULL) { decRefStr(invName); } if (!name.isReferenced()) return ret; } auto const tv_func = v.asCell(); if (IS_STRING_TYPE(tv_func->m_type)) { if (name.isReferenced()) name = tv_func->m_data.pstr; return ret; } if (tv_func->m_type == KindOfArray) { CArrRef arr = tv_func->m_data.parr; CVarRef clsname = arr.rvalAtRef(int64_t(0)); CVarRef mthname = arr.rvalAtRef(int64_t(1)); if (arr.size() != 2 || &clsname == &null_variant || &mthname == &null_variant) { name = v.toString(); return false; } auto const tv_meth = mthname.asCell(); if (!IS_STRING_TYPE(tv_meth->m_type)) { if (name.isReferenced()) name = v.toString(); return false; } auto const tv_cls = clsname.asCell(); if (tv_cls->m_type == KindOfObject) { name = tv_cls->m_data.pobj->o_getClassName(); } else if (IS_STRING_TYPE(tv_cls->m_type)) { name = tv_cls->m_data.pstr; } else { name = v.toString(); return false; } name = concat3(name, s_colon2, tv_meth->m_data.pstr); return ret; } if (tv_func->m_type == KindOfObject) { ObjectData *d = tv_func->m_data.pobj; const Func* invoke = d->getVMClass()->lookupMethod(s__invoke.get()); if (name.isReferenced()) { if (d->instanceof(c_Closure::classof())) { // Hack to stop the mangled name from showing up name = s_Closure__invoke; } else { name = d->o_getClassName() + "::__invoke"; } } return invoke != NULL; } return false; }
void PinholeImageData::deserialize(ObjectData& data, IdContext& context){ ImageData::deserialize(data,context); _sensor = dynamic_cast<PinholeImageSensor*>(data.getPointer("sensor")); }
void PinholeImageData::serialize(ObjectData& data, IdContext& context){ ImageData::serialize(data,context); data.setPointer("sensor",_sensor); }
void PinholeImageSensor::deserialize(ObjectData& data, IdContext& context){ BaseSensor::deserialize(data, context); _cameraMatrix.fromBOSS(data, "cameraMatrix"); _distortionModel=data.getString("distortionModel"); _distortionParameters.fromBOSS(data, "distortionParameters"); }
void PinholeImageSensor::serialize(ObjectData& data, IdContext& context){ BaseSensor::serialize(data, context); _cameraMatrix.toBOSS(data, "cameraMatrix"); data.setString("distortionModel", _distortionModel); _distortionParameters.toBOSS(data,"distortionParameters"); }
ObjectData* newPairHelper() { ObjectData *obj = NEWOBJ(c_Pair)(); obj->incRefCount(); TRACE(2, "newPairHelper: capacity 2\n"); return obj; }
void BaseSensor::deserialize(ObjectData& data, IdContext& context){ Identifiable::deserialize(data,context); _topic = data.getString("topic"); _frame = 0; data.getReference("frame").bind(_frame); }