//-------------------------------------------------------------- void testApp::draw(){ player.draw(0,0, 1280, 800); if(debug){ drawDebug(); } }
static int lua_newT(lua_State *L) { int argc = lua_gettop(L); #ifndef SKIP_ERROR_HANDLING if (argc != 0) return luaL_error(L, "wrong number of arguments."); #endif Timer* new_timer = (Timer*)malloc(sizeof(Timer)); // Calculating current frame new_timer->tick = osGetTime(); new_timer->magic = 0x4C544D52; new_timer->isPlaying = true; drawCommand("Timer.new: ","Timer created at offset 0x%lX.\n",(u32)new_timer); allocatedDatas = allocatedDatas + sizeof(Timer); size_t percent = (allocatedDatas * 100) / maxDatas; drawDebug("Debug: ","Allocated %lu bytes (Mem. usage: %u%%).\n",sizeof(Timer), percent); if (percent > 80) drawWarning("Warning: ", "High memory usage!"); if (percent > 100){ drawError("FATAL ERROR: ", "Out of memory!"); return luaL_error(L, "internal error."); } lua_pushinteger(L,(u32)new_timer); return 1; }
void jfBigBallisticSimulation_x86::run() { while(m_EventHandler->handleEvents()) { m_CurrentShotType = m_EventHandler->getCurrentShotType(); m_EventHandler->handleKeyEvents(); m_LastFrameDuration = m_Timer->getTicks(); m_Timer->start(); jfReal timeStep = ((jfReal)m_LastFrameDuration)/1000.0; if((m_EventHandler->getMouseEvent().getStatus() == EVENT_MOUSELEFT)) { if(!m_MousePressedLast) { m_MousePressedLast = true; fire(); } } else { m_MousePressedLast = false; } updateObjects(timeStep); generateContacts(); vector<jfContact*> contacts; m_CollisionData->getContacts(&contacts); m_ContactResolver->resolveContacts(contacts, timeStep); m_3DGraphicsHandler->draw(); drawDebug(); } }
void RendererDR::draw(ICamera& camera) { mGBuffer->setAttachments(); //bind for geom pass drawGeometryPass(camera); // drawAOPass(camera); drawColorPass(camera); drawDebug(); }
void ofxSceneManager::draw(){ if (currentScene != NULL){ vector <ofxScene*> scenesToDraw; scenesToDraw.push_back(currentScene); for (int i = 0; i < scenesToDraw.size(); i++){ ofxScene * s = scenesToDraw[i]; s->draw(); if (drawDebugInfo){ ofSetColor(255, 0, 0); s->drawDebug(); } } if ( !curtain.isReady() ){ curtain.draw(); } //curtain.drawDebug(); } if (drawDebugInfo){ ofSetColor(255, 0, 0); drawDebug(); } }
void RenderingEngine::drawDebug(SceneNode* node) { for (Component* component : node->getAllComponents()) component->drawDebugGeometry(debugRenderer_); for (SceneNode* child : node->getChildren()) drawDebug(child); }
//-------------------------------------------------------------- void ofxOpenNITT::draw() { ofSetColor(255, 255, 255); // drawUsers(); // draw3dUsers(); if ( debug_draw ) drawDebug(); // do some drawing of user clouds and masks string msg = " MILLIS: " + ofToString(ofGetElapsedTimeMillis()) + " FPS: " + ofToString(ofGetFrameRate()); ofDrawBitmapString(msg, 20, ofGetHeight()-25); }
void RenderSystem::update(entityx::EntityManager &enm, entityx::EventManager&, entityx::TimeDelta) { Game::renderTexture.setView(Game::registerEntity["camera"].component<Camera>()->view); Game::renderTexture.clear(); spritesZ.swap(std::vector<std::pair<float, sf::Sprite*>>()); for(auto &A : enm.entities_with_components<Sprite>()) { if(A.has_component<UI>()) continue; for(auto &i : A.component<Sprite>()->sprites) { spritesZ.push_back(std::pair<float, sf::Sprite*>(i.z, &i)); } handleEntity(A); } std::sort(spritesZ.begin(), spritesZ.end(), compare<sf::Sprite*>); for(auto it : spritesZ) { Game::renderTexture.draw(*it.second); } for(auto &A : enm.entities_with_components<Text>(texts)) { if(A.has_component<UI>()) continue; handleText(A); } for(auto &A : enm.entities_with_components<CircleShape>(circleShapes)) { handleCircleShape(A); } for(auto &A : enm.entities_with_components<ProgressBar>(progressBars)) { handleProgressBar(A); } for(auto &A : enm.entities_with_components<TriangleShape>(triangleShapes)) { handleTriangleShape(A); } if(sf::Keyboard::isKeyPressed(sf::Keyboard::Multiply)) { for(auto &A : enm.entities_with_components<HitCircle>()) { drawDebug(A); } } Game::renderTexture.setView(uiView); for(auto &A : enm.entities_with_components<UI>()) { handleEntity(A); if(A.has_component<Sprite>()) { for(auto &s : A.component<Sprite>()->sprites) Game::renderTexture.draw(s, (A.has_component<Shader>()) ? &A.component<Shader>()->shader : sf::RenderStates::Default); } if(A.has_component<ProgressBar>()) { Game::renderTexture.draw(sampleProgressBar); } if(A.has_component<Text>()) { Game::renderTexture.draw(*texts.get()); } } Game::renderTexture.setView(Game::registerEntity["camera"].component<Camera>()->view); Game::renderTexture.display(); Game::window.clear(); Game::window.draw(sf::Sprite(Game::renderTexture.getTexture())); Game::window.display(); }
void Group::draw() { if(!isDraw) return; foreach(Primitive* node, nodes) { // SimpleDraw::IdentifyPoint(node->centerPoint(), 0,0,1); } drawDebug(); }
/** The drawing method * * This method is called by the GameEngine for each frame. It just * calls the Irrlicht draw function. It also calls the drawDebug() * method if \c debug is set to \c true. * */ void RainbruRPG::Core::gsGame::run(){ irrDriver->beginScene(true, true, 0); irrSmgr->drawAll(); if (debug) drawDebug(); // draw gui irrGui->drawAll(); // On a fini d'écrire irrDriver->endScene(); }
static int lua_destroy(lua_State *L) { int argc = lua_gettop(L); #ifndef SKIP_ERROR_HANDLING if (argc != 1) return luaL_error(L, "wrong number of arguments."); #endif Timer* timer = (Timer*)luaL_checkinteger(L,1); #ifndef SKIP_ERROR_HANDLING if (timer->magic != 0x4C544D52) return luaL_error(L, "attempt to access wrong memory block type"); #endif free(timer); allocatedDatas = allocatedDatas - sizeof(Timer); size_t percent = (allocatedDatas * 100) / maxDatas; drawDebug("Debug: ","Deallocated %lu bytes (Mem. usage: %u%%).\n",sizeof(Timer), percent); return 1; }
void ofxColorPicker :: draw() { if( !bVisible ) return; ofPushStyle(); drawBackground(); drawColorWheel(); drawColorPoint(); drawColorScaleBar(); drawColorRect(); drawDebug(); ofPopStyle(); }
void Game::run() { //handle events SDL_Event event; while (SDL_PollEvent(&event)) { eventPump(event); } input.update(); //render and update; platformSDL->startFrame(); updateAndRender(platformSDL->deltaTime); if(debug){ drawDebug(); } platformSDL->endFrame(); }
void testApp :: draw() { ofBackground( 20, 20, 20 ); ofEnableAlphaBlending(); if( smoothing ) ofEnableSmoothing(); else ofDisableSmoothing(); glBlendFunc( blendModes[ blendModeIndex * 2 + 0 ], blendModes[ blendModeIndex * 2 + 1 ] ); tileSaver.begin(); glPushMatrix(); glTranslatef( renderArea.x, renderArea.y, 0 ); // drawSquareNoise( &fields[ 0 ] ); // drawTraingleStatic(); // drawTriangleNoise( &fields[ 0 ] ); for( int i=0; i<fieldsTotal; i++ ) drawTriangleNoise( &fields[ i ] ); // for( int i=0; i<fieldsTotal; i++ ) // drawTriangleVideo( &fields[ i ] ); // tfVideo.draw(); glPopMatrix(); tileSaver.end(); if( tileSaver.bGoTiling ) return; if( screenGrabUtil.isRecording() ) screenGrabUtil.save(); glBlendFunc( GL_ONE, GL_ZERO ); gui.draw(); if( showDebug ) drawDebug(); }
//-------------------------------------------------------------- void ofApp::draw() { ofBackground(0, 0, 0); // draw the smoke smoke.draw(); ofPushMatrix(); ofSetColor(0); ofScale(WIDTH / (float)kinect.width, HEIGHT / (float)kinect.height); contourMesh.draw(); ofSetColor(255); contourMesh.drawVertices(); if (showDebug) { ofSetColor(255, 0, 0); if (contoursManager.contourInfos.size() && contourFinder.blobs.size()) { for (int i = 0; i < contoursManager.contourInfos.size(); i++) { int tempX = contoursManager.contourInfos[i].point.x; int tempY = contoursManager.contourInfos[i].point.y; ofCircle(tempX, tempY, 5); stringstream ss; ss << i << endl; ss << ofGetElapsedTimef() - contoursManager.contourInfos[i].startTime; ofDrawBitmapStringHighlight(ss.str(), tempX, tempY); } } } ofPopMatrix(); dmxLightsAndSmokeMessage[2] = 0; dmxLightsAndSmokeMessage[3] = 0; dmxLightsAndSmokeMessage[4] = 255; // show debug video HUD if (showDebugVideo) { drawDebug(); } }
void ofApp::drawDemos() { switch (demoModes) { case 0: drawDebug(); break; case 1: drawRainbowH(); break; case 2: drawRainbowV(); break; case 3: drawWaves(); break; default: break; } }
//-------------------------------------------------------------- void ofApp::draw(){ player.draw(0,0, 1280, 800); if(debug){ drawDebug(); } if(drawLoading) { ofPushStyle(); ofSetColor(255, 255, 255, 127); ofRect(0,0,ofGetWidth(),ofGetHeight()); ofPopStyle(); string vid_dl_string = "Downloaded " + ofToString(videosDownloaded, 2) + " of " + ofToString(numVideosToGet, 2) + " videos. Please wait!"; ofDrawBitmapString(vid_dl_string, 0 ,ofGetHeight()/2); } //cout << "draw loading? : " << drawLoading << endl; }
//-------------------------------------------------------------- void testApp::draw() { tileSaver.begin(); ofFill(); ofSetColor( 0x000000 ); ofRect( 0, 0, ofGetWidth(), ofGetHeight() ); ofSetColor( 0xFFFFFF ); if( bDrawGhost ) { ofEnableAlphaBlending(); ofSetColor( 255, 255, 255, 40 ); cameraGrayDiffImage.draw( logoCropRect.x, logoCropRect.y, logoCropRect.width, logoCropRect.height ); ofDisableAlphaBlending(); ofSetColor( 0xFFFFFF ); } // ofEnableAlphaBlending(); // logoAlpha.draw( 0, 0 ); // ofDisableAlphaBlending(); if( bDebug ) { drawDebug(); } drawCirclePacker(); drawCircles(); // floor.draw(); // box2d.draw(); tileSaver.end(); screenGrab.save(); ofSetColor( 0xFFFFFF ); ofDrawBitmapString( ofToString( ofGetFrameRate(), 0 ), 10, ofGetHeight() - 10 ); }
//-------------------------------------------------------------- void testApp::draw(){ if(edit) ofClear(0); // ofSetColor(255); ofPushMatrix(); if(fullscreen) ofScale(1.25, 1.25); ofEnableBlendMode(OF_BLENDMODE_ADD); if(edit) drawEdit(); else drawGraphics(); if(debug) drawDebug(); ofPopMatrix(); float mult = ofMap(part->getMainVal(), 0.8, 1.0, 0.0, 0.3, true); ofEnableBlendMode(OF_BLENDMODE_MULTIPLY); berserk.begin(); d += 0.1; berserk.setUniform1f("t", d); berserk.setUniform1fv("multi", &mult); ofRect(0,0,ofGetWidth(), ofGetHeight()); berserk.end(); }
void testApp :: draw() { ofSetColor( 0xFFFFFF ); tileSaver.begin(); glPushMatrix(); glTranslatef( (int)( renderArea.x + renderArea.width * 0.5 ), (int)( renderArea.y + renderArea.height * 0.5 ), 0 ); glRotatef( rotateY, 0, 1, 0 ); sphereBg.draw(); drawRibbons(); glPopMatrix(); tileSaver.end(); if( screenGrabUtil.isRecording() ) screenGrabUtil.save(); drawDebug(); }
//-------------------------------------------------------------- void ofApp::draw(){ if (bDebug) { drawDebug(); return; } ofPushStyle(); ofBackground(0,0,0); ofSetColor(255,255,255); particleSystem.draw(); ofPopStyle(); ofSetColor(255,255,255); if (bGuiVisible) gui_GPUPart.draw(); }
//-------------------------------------------------------------- void testApp::draw(){ ofPushView(); mainFbo.begin(); cam.begin(); ofClear(0); ofBackground(ofColor::fromHsb(127,255,ofMap(getHiSynth(),0,1,-255,255))); simpleEmitter.draw(); plinkEmitter.draw(); cube.draw(); cubeField.draw(); ofPushMatrix(); ofRotateZ(180); cubeField.draw(); ofPopMatrix(); cam.end(); mainFbo.end(); mainFbo.draw(0,0,ofGetWidth(),ofGetHeight()); ofPopView(); if(isDebug) { drawDebug(); } }
void AIModule::onFrame() { workerManager->update(); buildManager->update(); buildOrderManager->update(); baseManager->update(); techManager->update(); upgradeManager->update(); supplyManager->update(); borderManager->update(); agentManager->update(); baseGuardManager->update(); mapStateManager->update(); repairManager->update(); commander->update(); arbitrator.update(); camera(); drawDebug(); }
void ExplosionDemo::display() { const static GLfloat lightPosition[] = {1,-1,0,0}; const static GLfloat lightPositionMirror[] = {1,1,0,0}; // Update the transform matrices of each box in turn for (Box *box = boxData; box < boxData+boxes; box++) { box->calculateInternals(); box->isOverlapping = false; } // Update the transform matrices of each ball in turn for (Ball *ball = ballData; ball < ballData+balls; ball++) { // Run the physics ball->calculateInternals(); } // Clear the viewport and set the camera direction RigidBodyApplication::display(); // Render each element in turn as a shadow glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_POSITION, lightPosition); glPushMatrix(); glMultMatrixf(floorMirror); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable(GL_COLOR_MATERIAL); for (Box *box = boxData; box < boxData+boxes; box++) { box->render(); } for (Ball *ball = ballData; ball < ballData+balls; ball++) { ball->render(); } glPopMatrix(); glDisable(GL_LIGHTING); glDisable(GL_COLOR_MATERIAL); // Draw some scale circles glColor3f(0.75, 0.75, 0.75); for (unsigned i = 1; i < 20; i++) { glBegin(GL_LINE_LOOP); for (unsigned j = 0; j < 32; j++) { float theta = 3.1415926f * j / 16.0f; glVertex3f(i*cosf(theta),0.0f,i*sinf(theta)); } glEnd(); } glBegin(GL_LINES); glVertex3f(-20,0,0); glVertex3f(20,0,0); glVertex3f(0,0,-20); glVertex3f(0,0,20); glEnd(); // Render each shadow in turn glEnable(GL_BLEND); glColor4f(0,0,0,0.1f); glDisable(GL_DEPTH_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); for (Box *box = boxData; box < boxData+boxes; box++) { box->renderShadow(); } for (Ball *ball = ballData; ball < ballData+balls; ball++) { ball->renderShadow(); } glDisable(GL_BLEND); // Render the boxes themselves glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_POSITION, lightPositionMirror); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable(GL_COLOR_MATERIAL); for (Box *box = boxData; box < boxData+boxes; box++) { box->render(); } for (Ball *ball = ballData; ball < ballData+balls; ball++) { ball->render(); } glDisable(GL_COLOR_MATERIAL); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); // Finish the frame, rendering any additional information drawDebug(); }
void RenderingEngine::render(Scene* scene) { graphics_->beginFrame(); Camera* cullCamera = scene->getCullCamera().get(); Camera* viewCamera = scene->getViewCamera().get(); sendCameraParametrs(viewCamera, meshShader_); sendCameraParametrs(viewCamera, terrainShader_); if (wireframe_) graphics_->setFillMode(FILL_WIREFRAME); std::vector<Component*> terrains; scene->getRootNode()->getComponentsRecursive("Terrain", terrains); std::vector<QuadTreeNode*> nodes; for (Component* comp : terrains) { Terrain* terrain = (Terrain*)comp; terrain->cullNodesToRender(cullCamera, nodes); } graphics_->setShader(terrainShader_); for (QuadTreeNode* node : nodes) { terrainShader_->setMatrix3x4("model", Matrix3x4()); terrainShader_->setBool("fDrawBorders", node->shouldDrawBorders()); terrainShader_->setColor("fColor", node->borderColor()); node->getPatch()->getGeometry()->draw(graphics_, node->getPatchTopology()->getIndexBuffer()); } graphics_->setFillMode(FILL_SOLID); debugRenderer_->addLine(Vector3(0.0f), Vector3(1.0f, 0.0f, 0.0f), Color::RED); debugRenderer_->addLine(Vector3(0.0f), Vector3(0.0f, 1.0f, 0.0f), Color::GREEN); debugRenderer_->addLine(Vector3(0.0f), Vector3(0.0f, 0.0f, 1.0f), Color::BLUE); if (renderDebug_) { debugRenderer_->setView(viewCamera); if (viewCamera != cullCamera) debugRenderer_->addFrustum(scene->getCullCamera()->getFrustum(), Color::WHITE); drawDebug(scene->getRootNode()); debugRenderer_->render(); debugRenderer_->handleEndFrame(); } if (renderUI_) { graphics_->setDepthTest(CMP_ALWAYS); uiRenderer_->renderLabels(scene->getLabels()); graphics_->setDepthTest(CMP_LESSEQUAL); } graphics_->endFrame(); }
void SkeletonRenderer::draw (Renderer* renderer, const Mat4& transform, uint32_t transformFlags) { SkeletonBatch* batch = SkeletonBatch::getInstance(); Color3B nodeColor = getColor(); _skeleton->r = nodeColor.r / (float)255; _skeleton->g = nodeColor.g / (float)255; _skeleton->b = nodeColor.b / (float)255; _skeleton->a = getDisplayedOpacity() / (float)255; Color4F color; AttachmentVertices* attachmentVertices = nullptr; for (int i = 0, n = _skeleton->slotsCount; i < n; ++i) { spSlot* slot = _skeleton->drawOrder[i]; if (!slot->attachment) continue; switch (slot->attachment->type) { case SP_ATTACHMENT_REGION: { spRegionAttachment* attachment = (spRegionAttachment*)slot->attachment; spRegionAttachment_computeWorldVertices(attachment, slot->bone, _worldVertices); attachmentVertices = getAttachmentVertices(attachment); color.r = attachment->r; color.g = attachment->g; color.b = attachment->b; color.a = attachment->a; break; } case SP_ATTACHMENT_MESH: { spMeshAttachment* attachment = (spMeshAttachment*)slot->attachment; spMeshAttachment_computeWorldVertices(attachment, slot, _worldVertices); attachmentVertices = getAttachmentVertices(attachment); color.r = attachment->r; color.g = attachment->g; color.b = attachment->b; color.a = attachment->a; break; } default: continue; } color.a *= _skeleton->a * slot->a * 255; float multiplier = _premultipliedAlpha ? color.a : 255; color.r *= _skeleton->r * slot->r * multiplier; color.g *= _skeleton->g * slot->g * multiplier; color.b *= _skeleton->b * slot->b * multiplier; for (int v = 0, w = 0, vn = attachmentVertices->_triangles->vertCount; v < vn; ++v, w += 2) { V3F_C4B_T2F* vertex = attachmentVertices->_triangles->verts + v; vertex->vertices.x = _worldVertices[w]; vertex->vertices.y = _worldVertices[w + 1]; vertex->colors.r = (GLubyte)color.r; vertex->colors.g = (GLubyte)color.g; vertex->colors.b = (GLubyte)color.b; vertex->colors.a = (GLubyte)color.a; } BlendFunc blendFunc; switch (slot->data->blendMode) { case SP_BLEND_MODE_ADDITIVE: blendFunc.src = _premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; blendFunc.dst = GL_ONE; break; case SP_BLEND_MODE_MULTIPLY: blendFunc.src = GL_DST_COLOR; blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA; break; case SP_BLEND_MODE_SCREEN: blendFunc.src = GL_ONE; blendFunc.dst = GL_ONE_MINUS_SRC_COLOR; break; default: blendFunc.src = _premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA; } batch->addCommand(renderer, _globalZOrder, attachmentVertices->_texture->getName(), _glProgramState, blendFunc, *attachmentVertices->_triangles, transform, transformFlags); } if (_debugSlots || _debugBones) { drawDebug(renderer, transform, transformFlags); } }