void BSPSceneDatabase::insertDynamic(int level, Node* root, SceneNode* node) { GLfloat d; if (!root->dynamic && root->node->getPlane()) { const GLfloat* plane = root->node->getPlane(); const GLfloat* pos = node->getSphere(); d = pos[0] * plane[0] + pos[1] * plane[1] + pos[2] * plane[2] + plane[3]; } else { d = root->node->getDistance(eye) - node->getDistance(eye); } if (d >= 0.0) { if (root->front) { insertDynamic(level + 1, root->front, node); } else { root->front = new Node(true, node); setDepth(level + 1); } } else { if (root->back) { insertDynamic(level + 1, root->back, node); } else { root->back = new Node(true, node); setDepth(level + 1); } } }
LogitechDevice::LogitechDevice( LH_LgLcdMan *drv, bool bw ) : LH_QtDevice(drv) { drv_ = drv; opened_ = false; bw_ = bw; buttonState_ = 0; if( bw_ ) { setDevid( "BW" ); setName( QObject::tr("Logitech B/W device") ); setSize( 160, 43 ); setDepth( 1 ); } else { setDevid( "QVGA" ); setName( QObject::tr("Logitech QVGA device") ); setSize( 320, 240 ); setDepth( 32 ); } arrive(); return; }
double setDepth(t_Node* ptTree, double dDepth) { double dOldDepth = dDepth; ptTree->dDepth = dDepth; if(ptTree->nId == INTERNAL){ setDepth(ptTree->ptLeft, dDepth + ptTree->dLeft); setDepth(ptTree->ptRight, dDepth + ptTree->dRight); } return; }
void setDepth(data *Dat, daux *Aux, int pl, int pr, int il, int ir, int level) { int j=0; if (pl>pr) return; int pre=Aux[pl].preorder; for (j=il; j<ir; j++) { if (Dat[j].inorder==pre) break; } Dat[j].he=level; if (flag%19==0) Dat[j].UDI=Aux[pl].UDP; if (flag%29==0) Dat[j].LDI=Aux[pl].LDP; setDepth(Dat,Aux,pl+1,pl+j-il,il,j-1,level+1); setDepth(Dat,Aux,pl+1+j-il,pr,j+1,ir,level+1); }
void BSPSceneDatabase::insertStatic(int level, Node* root, SceneNode* node) { // dynamic nodes should only be inserted after all static nodes assert(root->dynamic == 0); // split against root's plane SceneNode* front = NULL, *back = NULL; switch (node->split(root->node->getPlane(), front, back)) { case 0: // copy style to new nodes // FIXME -- only WallSceneNodes are static but should make type safe ((WallSceneNode*)front)->copyStyle((WallSceneNode*)node); ((WallSceneNode*)back)->copyStyle((WallSceneNode*)node); // done with split node so get rid of it delete node; break; case 1: // completely in front front = node; break; case -1: // completely in back back = node; break; } // add nodes if (front) { if (root->front) { insertStatic(level + 1, root->front, front); } else { root->front = new Node(false, front); setDepth(level + 1); } root->count++; } if (back) { if (root->back) { insertStatic(level + 1, root->back, back); } else { root->back = new Node(false, back); setDepth(level + 1); } root->count++; } }
OpenNIUser::OpenNIUser(ofxOpenNIUser * user) { this->user = user; setFilterLevel(SOFT); setFeatureTrackingEnabled(false); setDepth(30); }
MDQuote::MDQuote(const char* buf) //deserializing { int offset = 0; UNSIGNED_CHARACTER tmpChar = 0; UNSIGNED_LONG tmpLong1 = 0, tmpLong2 = 0; DESERIALIZE_64(tmpLong1, tmpLong2, setSymbolId(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setNummberOfTrades(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setVolume(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setValue(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setLastTradePrice(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setLastTradeQty(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setOpenPrice(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setClosePrice(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setHighPrice(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setLowPrice(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setTotalBidQty(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setTotalAskQty(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setLowerCktLimit(tmpLong2), buf, offset); DESERIALIZE_64(tmpLong1, tmpLong2, setUpperCktLimit(tmpLong2), buf, offset); DESERIALIZE_8(tmpChar, setDepth(tmpChar), buf, offset); memcpy( _bidPrice, buf+offset, QUOTEDATA_LENGTH); offset += QUOTEDATA_LENGTH; memcpy(_bidQty, buf+offset, QUOTEDATA_LENGTH); offset += QUOTEDATA_LENGTH; memcpy( _askPrice, buf+offset, QUOTEDATA_LENGTH); offset += QUOTEDATA_LENGTH; memcpy(_askQty, buf+offset, QUOTEDATA_LENGTH); offset += QUOTEDATA_LENGTH; }
//--------------------------------------------------- TremoloDSP::TremoloDSP( XMLParser& parser, XMLNode* tremoloNode ) : DSP( MONKY_DSP_TYPE_TREMOLO ) { const float NO_VALUE_SPECIFIED = -1000000000.0f; parser.validateXMLAttributes( tremoloNode, "", "type,frequency,depth,shape,timeSkewing,duty,flatness,phase,spread" ); float frequency = parser.getXMLAttributeAsFloat( tremoloNode, "frequency", NO_VALUE_SPECIFIED ); float depth = parser.getXMLAttributeAsFloat( tremoloNode, "depth", NO_VALUE_SPECIFIED ); float shape = parser.getXMLAttributeAsFloat( tremoloNode, "shape", NO_VALUE_SPECIFIED ); float timeSkewing = parser.getXMLAttributeAsFloat( tremoloNode, "timeSkewing", NO_VALUE_SPECIFIED ); float duty = parser.getXMLAttributeAsFloat( tremoloNode, "duty", NO_VALUE_SPECIFIED ); float flatness = parser.getXMLAttributeAsFloat( tremoloNode, "flatness", NO_VALUE_SPECIFIED ); float phase = parser.getXMLAttributeAsFloat( tremoloNode, "phase", NO_VALUE_SPECIFIED ); float spread = parser.getXMLAttributeAsFloat( tremoloNode, "spread", NO_VALUE_SPECIFIED ); if( frequency != NO_VALUE_SPECIFIED ) setFrequency( frequency ); if( depth != NO_VALUE_SPECIFIED ) setDepth( depth ); if( shape != NO_VALUE_SPECIFIED ) setShape( shape ); if( timeSkewing != NO_VALUE_SPECIFIED ) setTimeSkewing( timeSkewing ); if( duty != NO_VALUE_SPECIFIED ) setDuty( duty ); if( flatness != NO_VALUE_SPECIFIED ) setFlatness( flatness ); if( phase != NO_VALUE_SPECIFIED ) setPhase( phase ); if( spread != NO_VALUE_SPECIFIED ) setSpread( spread ); }
Camera* HMDScene::setupCamera(float ratio, bool left) { auto s = Director::getInstance()->getWinSize(); auto sizeInpixels = Director::getInstance()->getWinSizeInPixels(); auto fboSize = Size(sizeInpixels.width * 1.f, sizeInpixels.height * 1.f); auto fbo = experimental::FrameBuffer::create(1, fboSize.width, fboSize.height); auto rt = experimental::RenderTarget::create(fboSize.width, fboSize.height); auto rtDS = experimental::RenderTargetDepthStencil::create(fboSize.width, fboSize.height); fbo->attachRenderTarget(rt); fbo->attachDepthStencilTarget(rtDS); auto sprite = Sprite::createWithTexture(fbo->getRenderTarget()->getTexture()); sprite->setPosition((left ? s.width * 0.25f : s.width * 0.75f) , s.height * 0.5f); sprite->setRotation3D(Vec3(0.0f, 180.0f, 180.0f)); sprite->setScale(0.5f, 1.0f); Scene::addChild(sprite); auto cam = Camera::createPerspective(60, ratio, 0.01f, 100.0f); cam->setPosition3D(Vec3(0.0f, 0.0f, 0.0f)); cam->setCameraFlag(left ? CameraFlag::USER7 : CameraFlag::USER8); cam->setDepth(-1); cam->setName( (left ? "HMD-Cam-L" : "HMD-Cam-R") ); cam->setFrameBufferObject(fbo); // useful for debugging viewport stuff //fbo->setClearColor(Color4F( (left ? 0.25f : 0.0f) , (left ? 0.0f : 0.25f), 0, 1)); return cam; }
GLRender::GLRender(GLint clientWidth, GLint clientHeight) throw(const char*) : GLCore(clientWidth, clientHeight) { textures = new GLTextures(this); shaders = new GLShaders(this); sprites = new GLSprites(this); scenes = new GLScenes(this); cameras = new GLCameras(this); models = new GLModels(this); particles = new GLParticles(this); drawings = new GLDrawings(this); funcs = new GLFuncs(this); mixer = new GLSoundMixer(this); cameras->createCamera(L"gui")->size(clientWidth, clientHeight)->layer(0, 0); cameras->createCamera(L"background")->size(clientWidth, clientHeight)->background(); lightsMaxCount = 6; setDepth(1.0, 0.0, 1.0, GL_LEQUAL); setBlend(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_FUNC_ADD); glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); glGenBuffers(1, &m_squareBuffer); glGenBuffers(1, &m_textureBuffer); glGenBuffers(1, &m_normalBuffer); glGenBuffers(1, &m_indexBuffer); light.set(1.0); LOG("GLRender Create"); }
MobileDive::MobileDive(dive *d) { m_thisDive = d; setDiveNumber(QString::number(d->number)); setDiveId(QString::number(d->id)); dive_trip *trip = d->divetrip; if(trip) { //trip is valid setTrip(trip->location); } setDate(get_dive_date_string(d->when)); setDepth(get_depth_string(d->maxdepth)); setDuration(get_dive_duration_string(d->duration.seconds, "h:","min")); setupDiveTempDetails(); weight_t tw = { total_weight(d) }; setWeight(weight_string(tw.grams)); setSuit(QString(d->suit)); setCylinder(QString(d->cylinder[0].type.description)); setSac(QString::number(d->sac)); setLocation(get_dive_location(d)); setNotes(d->notes); setBuddy(d->buddy); setDivemaster(d->divemaster); }
void DUpdateVisitor::visitMObject(const MObject *object) { auto dobject = dynamic_cast<DObject *>(m_target); QMT_CHECK(dobject); if (isUpdating(object->stereotypes() != dobject->stereotypes())) dobject->setStereotypes(object->stereotypes()); const MObject *objectOwner = object->owner(); const MObject *diagramOwner = m_diagram->owner(); if (objectOwner && diagramOwner && objectOwner->uid() != diagramOwner->uid()) { if (isUpdating(objectOwner->name() != dobject->context())) dobject->setContext(objectOwner->name()); } else { if (isUpdating(!dobject->context().isEmpty())) dobject->setContext(QString()); } if (isUpdating(object->name() != dobject->name())) dobject->setName(object->name()); // TODO unlikely that this is called for all objects if hierarchy is modified // PERFORM remove loop int depth = 1; const MObject *owner = object->owner(); while (owner) { owner = owner->owner(); depth += 1; } if (isUpdating(depth != dobject->depth())) dobject->setDepth(depth); visitMElement(object); }
/*public*/ void DirectedEdge::setEdgeDepths(int position, int newDepth) { // get the depth transition delta from R to L for this directed Edge int depthDelta=getEdge()->getDepthDelta(); if (!isForwardVar) depthDelta=-depthDelta; // if moving from L to R instead of R to L must change sign of delta int directionFactor=1; if (position==Position::LEFT) directionFactor=-1; int oppositePos=Position::opposite(position); int delta=depthDelta*directionFactor; //TESTINGint delta = depthDelta * DirectedEdge.depthFactor(loc, oppositeLoc); int oppositeDepth=newDepth+delta; setDepth(position,newDepth); setDepth(oppositePos,oppositeDepth); }
// set player name void LiveInfo::setPlayer( int color, const QString &txt ) { (color == cheng4::ctWhite ? ui->engineLabel : ui->engineLabel_2)->setText( txt ); // reset engine stats setDepth( color, 0 ); setScore( color, 0 ); setNodes( color, 0, 0 ); setPV( color, QString() ); }
/*! Set the minimum depth buffer size to \a size. \sa depthBufferSize(), setDepth(), depth() */ void QPlatformWindowFormat::setDepthBufferSize(int size) { detach(); if (size < 0) { qWarning("QPlatformWindowFormat::setDepthBufferSize: Cannot set negative depth buffer size %d", size); return; } d->depthSize = size; setDepth(size > 0); }
int montagePair::init(displayContext *context, sagePixFmt pfmt, int index, float depth) { montage[0] = new sageMontage(context, pfmt); montage[1] = new sageMontage(context, pfmt); //tileID = id; setLocalTileIdx(index); setDepth(depth); return 0; }
CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color4F& color, float depth) { auto ret = new (std::nothrow) CameraBackgroundColorBrush(); ret->init(); ret->setColor(color); ret->setDepth(depth); ret->autorelease(); return ret; }
void BSPSceneDatabase::addDynamicNode(SceneNode* node) { // insert dynamic node if (!root) { root = new Node(true, node); setDepth(1); } else { insertDynamic(1, root, node); } }
void setDepth(int i) { if (i == -1) return; int leftSon = nodes[i].leftSon, rightSon = nodes[i].rightSon; setDepth(leftSon); setDepth(rightSon); if (leftSon == -1) leftDepth[i] = 0; else leftDepth[i] = std::max(leftDepth[leftSon], rightDepth[leftSon]) + 1; if (rightSon == -1) rightDepth[i] = 0; else rightDepth[i] = std::max(leftDepth[rightSon], rightDepth[rightSon]) + 1; }
void BSPSceneDatabase::addStaticNode(SceneNode* node) { // make sure node has a definite plane for splitting assert(node->getPlane()); // insert static node if (!root) { root = new Node(false, node); setDepth(1); } else { insertStatic(1, root, node); } }
void Debugger::onCreate() { setDepth(100); setMeta(true); setPersistent(true); cursor_spr = false; // Try and load a cursor sprite if one isn't supplied. try { if (Sprite::getTexture("debug_cursor") == nullptr) { Sprite::load("debug_cursor", "images/debug_cursor.png"); } cursor_spr = true; } catch (FlexiumException& e) {} }
Doodad::Doodad(engine::graphics::Texture* texture, Tile* tile) : m_tile(tile) { resetTextureCoords(); setTexture(texture); setCenter(engine::Vector2d(texture->getWidth() / 2, texture->getWidth() / 4)); setDimensions(texture->getDimensions()); setPosition(tile->getPosition()); static const float min = 0.0001; static const int maxSize = 3; static const int size = 1; setDepth(tile->getDepth() + min * maxSize - min * size); }
SceneLayer::SceneLayer(std::string _name, Filter _filter, std::vector<DrawRuleData> _rules, std::vector<SceneLayer> _sublayers, bool _enabled) : m_filter(std::move(_filter)), m_name(_name), m_rules(_rules), m_sublayers(std::move(_sublayers)), m_enabled(_enabled) { setDepth(1); }
QVNCScreen::QVNCScreen(QRect screenSize, int screenId) : QFbScreen::QFbScreen() { setGeometry(screenSize); setDepth(32); setFormat(QImage::Format_RGB32); setPhysicalSize((geometry().size()*254)/720); d_ptr = new QVNCScreenPrivate(this, screenId); cursor = new QVNCCursor(d_ptr->vncServer, this); d_ptr->vncServer->setCursor(static_cast<QVNCCursor *>(cursor)); }
void CameraFrameBufferTest::onEnter() { auto sizeInpixels = Director::getInstance()->getWinSizeInPixels(); auto size = Director::getInstance()->getWinSize(); auto fboSize = Size(sizeInpixels.width * 1, sizeInpixels.height * 1.5); auto fbo = experimental::FrameBuffer::create(1, fboSize.width, fboSize.height); CameraBaseTest::onEnter(); //auto sprite = Sprite::createWithTexture(fbo); //sprite->setPosition(Vec2(100,100)); //std::string filename = "Sprite3DTest/girl.c3b"; //auto sprite = Sprite3D::create(filename); //sprite->setScale(1.0); //auto animation = Animation3D::create(filename); //if (animation) //{ // auto animate = Animate3D::create(animation); // sprite->runAction(RepeatForever::create(animate)); //} //sprite->setPosition(Vec2(100,100)); auto rt = experimental::RenderTarget::create(fboSize.width, fboSize.height); auto rtDS = experimental::RenderTargetDepthStencil::create(fboSize.width, fboSize.height); fbo->attachRenderTarget(rt); fbo->attachDepthStencilTarget(rtDS); auto sprite = Sprite::createWithTexture(fbo->getRenderTarget()->getTexture()); sprite->setScale(0.3); sprite->runAction(RepeatForever::create(RotateBy::create(1, 90))); sprite->setPosition(size.width/2, size.height/2); addChild(sprite); auto sprite2 = Sprite::create(s_pathGrossini); sprite2->setPosition(Vec2(size.width/5,size.height/5)); addChild(sprite2); sprite2->setCameraMask((unsigned short)CameraFlag::USER1); auto move = MoveBy::create(1.0, Vec2(100,100)); sprite2->runAction( RepeatForever::create( Sequence::createWithTwoActions( move, move->reverse()) ) ); auto camera = Camera::create(); camera->setCameraFlag(CameraFlag::USER1); camera->setDepth(-1); camera->setFrameBufferObject(fbo); fbo->setClearColor(Color4F(1,1,1,1)); addChild(camera); }
void Simbox::CopyAllPadding(const Simbox & original, double lz_limit, std::string & err_txt) { setDepth(original.GetTopSurface(), original.GetBotSurface(), original.getnz(), true); calculateDz(lz_limit, err_txt); SetNXpad(original.GetNXpad()); SetNYpad(original.GetNYpad()); SetNZpad(original.GetNZpad()); SetXPadFactor(original.GetXPadFactor()); SetYPadFactor(original.GetYPadFactor()); SetZPadFactor(original.GetZPadFactor()); }
void DFlatAssignmentVisitor::visitDObject(const DObject *object) { visitDElement(object); auto target = dynamic_cast<DObject *>(m_target); QMT_CHECK(target); target->setStereotypes(object->stereotypes()); target->setName(object->name()); target->setPos(object->pos()); target->setRect(object->rect()); target->setAutoSized(object->isAutoSized()); target->setDepth(object->depth()); target->setVisualPrimaryRole(object->visualPrimaryRole()); target->setVisualSecondaryRole(object->visualSecondaryRole()); target->setVisualEmphasized(object->isVisualEmphasized()); target->setStereotypeDisplay(object->stereotypeDisplay()); }
ofxKinectFeatures::ofxKinectFeatures(int head, int torso){ newValues_ = false; setDepth(30); aFilter = lpf_soft_a; bFilter = lpf_soft_b; aLpd1 = lpd1_soft_a; bLpd1 = lpd1_soft_b; aLpd2 = lpd2_soft_a; bLpd2 = lpd2_soft_b; head_ = head; torso_ = torso; for (int i = 0; i < depth_; i++) { qom_.push_back(0.0); ci_.push_back(0.0); } }
GroundBase::GroundBase(je::Level *level, const sf::Vector2f& pos, const sf::Vector2i& dim) :je::Entity(level, "GroundBase", pos, dim) ,grassTex(level->getGame().getTexManager().get("grass.png")) ,grass(grassTex) ,dirtTex(level->getGame().getTexManager().get("dirt.png")) ,dirt(dirtTex) { grass.setPosition(pos.x, pos.y - 4.f); grassTex.setRepeated(true); grass.setTextureRect(sf::IntRect(0.f, 0.f, dim.x, 16.f)); dirt.setPosition(pos); dirtTex.setRepeated(true); dirt.setTextureRect(sf::IntRect(0.f, 0.f, dim.x, dim.y)); setDepth(-10); }
ofxKinectFeatures::ofxKinectFeatures(){ newValues_ = false; setDepth(30); aFilter = lpf_soft_a; bFilter = lpf_soft_b; aLpd1 = lpd1_soft_a; bLpd1 = lpd1_soft_b; aLpd2 = lpd2_soft_a; bLpd2 = lpd2_soft_b; //TODO for (int i = 0; i < depth_; i++) { qom_.push_back(0.0); ci_.push_back(0.0); } }