void GenericHolder::drawAll() { glUseProgram(shaderProgram); glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, vbo); for (std::vector<GenericObject*>::iterator it = objs.begin(); it != objs.end(); ){ GenericObject* itObj = *it; if (itObj->markedForDeath){ delete itObj; it = objs.erase(it); } else { double reps = (itObj->distMoved()) + 1; auto rotation = (itObj)->rotation(); auto newTrans = ((itObj)->translate())*rotation; auto oldTrans = ((itObj)->translateOld())*rotation; for (int i = 0; i <= reps; i++){ GLint uniTrans = glGetUniformLocation(shaderProgram, "trans"); glUniformMatrix4fv(uniTrans, 1, GL_FALSE, glm::value_ptr(glm::interpolate(oldTrans, newTrans, i / (float)reps))); draw(); } ++it; } } }
void DataSourceInterface::assignId(DataSourceEntityMapping& dsemp, ClassInfo& clas, void* entity) { GenericObject idv; next(dsemp, idv); if(!idv.isNull()) { Field fld = clas.getField(dsemp.getIdPropertyName()); vector<void *> valus; if(GenericObject::isNumber32(idv.getTypeName()) && GenericObject::isNumber(fld.getType())) { long* id; idv.get(id); valus.push_back(id); } else if(GenericObject::isNumber64(idv.getTypeName()) && GenericObject::isNumber(fld.getType())) { long long* id; idv.get(id); valus.push_back(id); } else if(GenericObject::isFPN(idv.getTypeName()) && GenericObject::isFPN(fld.getType())) { long double* id; idv.get(id); valus.push_back(id); } else if(GenericObject::isString(idv.getTypeName()) && GenericObject::isString(fld.getType())) { string* id; idv.set(id); valus.push_back(id); } else { throw "Data-Source-Object/Entity types do not match for id property" + dsemp.getClassName() + ":" + dsemp.getIdPropertyName(); } args argus; argus.push_back(fld.getType()); string methname = "set"+StringUtil::capitalizedCopy(fld.getFieldName()); Method meth = clas.getMethod(methname,argus); reflector->invokeMethodGVP(entity,meth,valus); } }
bool CacheInterface::replace(const std::string& key, const unsigned short& value, const int& expireSeconds) { GenericObject ob; ob.set(value); bool status = replace(key, ob, expireSeconds); return status; }
bool CacheInterface::set(const std::string& key, const int& value, const int& expireSeconds) { GenericObject ob; ob.set(value); bool status = set(key, ob, expireSeconds); return status; }
bool MemoryCacheImpl::replace(const std::string& key, GenericObject& value, const int& expireSeconds) { std::string valueStr = value.getSerilaizedState(); bool status = setInternal(key, valueStr, expireSeconds, 3); return status; }