void Raytracer::renderToImage(std::shared_ptr<Image> image) const { if (!mScene) return; if (!mScene->camera()) return; mScene->prepareScene(); Camera &camera = *(mScene->camera().get()); camera.setResolution(image->width(), image->height()); #ifdef NDEBUG #pragma omp parallel for schedule(dynamic,16) //collapse(2) #endif for (int y = 0; y < (int) (image->height()); ++y) for (int x = 0; x < (int) (image->width()); ++x) { // ray shot from camera position through camera pixel into scene const Ray ray = camera.ray(x, y); // call recursive raytracing function Vec4d color = this->trace(ray, 0); image->setPixel(color, x, y); } }
void OculusWindow::display(std::shared_ptr<Texture> const& texture, bool is_left) { auto const& glapi = ctx_.render_context->opengl_api(); // setup draw buffer GLuint tex_id; int current_index; ovr_GetTextureSwapChainCurrentIndex(hmd_session_, texture_swap_chain_, ¤t_index); ovr_GetTextureSwapChainBufferGL(hmd_session_, texture_swap_chain_, current_index, &tex_id); glapi.glBindTexture(GL_TEXTURE_2D, tex_id); glapi.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, blit_fbo_write_); glapi.glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex_id, 0); GLenum status = glapi.glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { gua::Logger::LOG_WARNING << "Incomplete.\n"; } // setup read buffer glapi.glBindTexture(GL_TEXTURE_2D, texture->get_buffer(ctx_)->object_id()); glapi.glBindFramebuffer(GL_READ_FRAMEBUFFER, blit_fbo_read_); glapi.glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->get_buffer(ctx_)->object_id(), 0); //glapi.glFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0); status = glapi.glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); if (status != GL_FRAMEBUFFER_COMPLETE) { gua::Logger::LOG_WARNING << "Incomplete.\n"; } if (is_left) { glapi.glBlitFramebuffer(0, texture->height(), texture->width(), 0, config.left_position().x, config.left_position().y, config.left_resolution().x, config.left_resolution().y, GL_COLOR_BUFFER_BIT, GL_NEAREST); } else { glapi.glBlitFramebuffer(0, texture->height(), texture->width(), 0, config.right_position().x, config.right_position().y, config.right_position().x + config.right_resolution().x, config.right_resolution().y, GL_COLOR_BUFFER_BIT, GL_NEAREST); } glapi.glBindTexture(GL_TEXTURE_2D, 0); glapi.glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glapi.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); WindowBase::display(texture, is_left); }
Image::Image(std::shared_ptr<libfalltergeist::FrmFileType> frm, unsigned int direction) { setTexture(new Texture(frm->width(), frm->height())); _texture->loadFromRGBA(frm->rgba(ResourceManager::palFileType("color.pal"))); setXOffset(frm->offsetX(direction) + frm->shiftX(direction) - width()/2); setYOffset(frm->offsetY(direction) + frm->shiftY(direction) - height()); }
inline size_t CameraSet<T>::add( std::shared_ptr<cimg_library::CImg<uint8_t> > image, const std::string& name, const size_t cameraID ) { // assemble the pose Pose_d pose; pose.id = m_poseCount; pose.name = name; pose.image = image; // add the pose m_cameras[cameraID].poses.push_back( pose ); // get the image size Eigen::Vector2i imageSize( image->width(), image->height() ); // make sure the image sizes are the same if( m_cameras[cameraID].poses.size() == 1 ) { m_cameras[cameraID].id = cameraID; m_cameras[cameraID].imageSize = imageSize; } else { Eigen::Vector2i tmp = imageSize - m_cameras[cameraID].imageSize; if( (tmp(0) != 0) || (tmp(1) != 0) ) throw std::runtime_error( "CameraSet::addImage: pose has different image size than already stored poses." ); } // increment pose count and return id m_poseCount++; return pose.id; }
bool Volume::update_color_map(RenderContext const& ctx, std::shared_ptr<Texture2D> transfer_texture_ptr, const scm::data::piecewise_function_1d<float, float>& in_alpha, const scm::data::piecewise_function_1d<float, scm::math::vec3f>& in_color) const { using namespace scm::gl; using namespace scm::math; scm::scoped_array<scm::math::vec3f> color_lut; scm::scoped_array<float> alpha_lut; unsigned in_size = transfer_texture_ptr->width(); color_lut.reset(new vec3f[in_size]); alpha_lut.reset(new float[in_size]); if (!scm::data::build_lookup_table(color_lut, in_color, in_size) || !scm::data::build_lookup_table(alpha_lut, in_alpha, in_size)) { Logger::LOG_WARNING << "volume_data::update_color_alpha_map(): error during lookuptable generation" << std::endl; return false; } scm::scoped_array<float> combined_lut; combined_lut.reset(new float[in_size * 4]); for (unsigned i = 0; i < in_size; ++i) { combined_lut[i * 4] = color_lut[i].x; combined_lut[i * 4 + 1] = color_lut[i].y; combined_lut[i * 4 + 2] = color_lut[i].z; combined_lut[i * 4 + 3] = alpha_lut[i]; } //MESSAGE("generating color map texture data done."); //MESSAGE("uploading texture data ( size: %d KiB)...", static_cast<double>(in_size * size_of_format(FORMAT_RGBA_32F)) / (1024.0)); texture_region ur(vec3ui(0u), vec3ui(in_size, 1, 1)); bool res = ctx.render_context->update_sub_texture(transfer_texture_ptr->get_buffer(ctx), ur, 0u, FORMAT_RGBA_32F, combined_lut.get()); //MESSAGE("uploading texture data done."); if (!res) { Logger::LOG_WARNING << "Volume::update_color_alpha_map(): error during color map texture generation." << std::endl; return false; } return true; }
bool validate() const { mapnik::request m_req(width_,height_,extent_); mapnik::image_32 im(m_->width(),m_->height()); mapnik::attributes variables; m_req.set_buffer_size(m_->buffer_size()); mapnik::projection map_proj(m_->srs(),true); double scale_denom = mapnik::scale_denominator(m_req.scale(),map_proj.is_geographic()); scale_denom *= scale_factor_; mapnik::agg_renderer<mapnik::image_32> ren(*m_,m_req,variables,im,scale_factor_); ren.start_map_processing(*m_); std::vector<mapnik::layer> const& layers = m_->layers(); process_layers(ren,m_req,map_proj,layers,scale_denom); ren.end_map_processing(*m_); if (!preview_.empty()) { std::clog << "preview available at " << preview_ << "\n"; mapnik::save_to_file(im,preview_); } return true; }
void operator()() const { if (preview_.empty()) { for (unsigned i=0;i<iterations_;++i) { mapnik::request m_req(width_,height_,extent_); mapnik::image_32 im(m_->width(),m_->height()); mapnik::attributes variables; m_req.set_buffer_size(m_->buffer_size()); mapnik::projection map_proj(m_->srs(),true); double scale_denom = mapnik::scale_denominator(m_req.scale(),map_proj.is_geographic()); scale_denom *= scale_factor_; mapnik::agg_renderer<mapnik::image_32> ren(*m_,m_req,variables,im,scale_factor_); ren.start_map_processing(*m_); std::vector<mapnik::layer> const& layers = m_->layers(); process_layers(ren,m_req,map_proj,layers,scale_denom); ren.end_map_processing(*m_); } } }
void Relocalizer::updateCurrentFrame(std::shared_ptr<Frame> currentFrame) { boost::unique_lock<boost::mutex> lock(exMutex); if(hasResult) return; this->CurrentRelocFrame = currentFrame; // int doneLast = KFForReloc.size() - (maxRelocIDX-nextRelocIDX); maxRelocIDX = nextRelocIDX + KFForReloc.size(); newCurrentFrameSignal.notify_all(); lock.unlock(); // printf("tried last on %d. set new current frame %d. trying %d to %d!\n", // doneLast, // currentFrame->id(), nextRelocIDX, maxRelocIDX); if (displayDepthMap) Util::displayImage( "DebugWindow DEPTH", cv::Mat(currentFrame->height(), currentFrame->width(), CV_32F, currentFrame->image())*(1/255.0f), false ); int pressedKey = Util::waitKey(1); handleKey(pressedKey); }
tsTestTerrain::tsTestTerrain(std::shared_ptr<Application> app) : Screen(app), m_timer(0), m_disable_cam(false) { // (-) TERRAIN m_hm_terrain = std::make_shared<HeightMapTerrain>(2); m_world.setTerrain(m_hm_terrain); // (-) SHADER m_defaultShader = false; m_shadowRenderer = std::make_shared<ShadowRenderer>(app->width(), app->height(), m_cam.get()); m_def = std::make_shared<DeferredRenderer>(app->width(), app->height()); m_part = std::make_shared<ParticleManager>(); { std::shared_ptr<PointLight> l = std::make_shared<PointLight>(); l->position = glm::vec3(3, 3, 3); l->constant = .5f; l->linear = 0.39f; l->quadratic = .032f; l->ambient = glm::vec3(.05f); l->diffuse = glm::vec3(0.95f); l->specular = glm::vec3(.95f); std::shared_ptr<Shape> light_shape = std::make_shared<Shape>("sphere"); light_shape->setSize(0.1f); light_shape->setColor(glm::vec3(0.8f, 0.8f, 0.8f)); light_shape->setPosition(glm::vec3(3.f, 3.f, 3.f)); m_world.addShape(light_shape); // PointLight l2; // l2.position = glm::vec3(-5, 3, 17); // l2.constant = 1.0f; // l2.linear = 0.09f; // l2.quadratic = .032f; // l2.ambient = glm::vec3(.05f, .05f, .05f); // l2.diffuse = glm::vec3(0.8f, 0.8f, 0.8f); // l2.specular = glm::vec3(.5f, .5f, .5f); m_def->addLight(l); //m_def->addLight(l2); m_shadowRenderer->setLightPosition(l->position); } // (-) ENTITIES m_skybox = std::make_shared<Skybox>(m_cam); std::shared_ptr<CubeGeometry> cubeGeo = std::make_shared<CubeGeometry>(); GeometryManager::addGeometry("cube", cubeGeo); std::shared_ptr<ConeGeometry> coneGeo = std::make_shared<ConeGeometry>(); GeometryManager::addGeometry("cone", coneGeo); std::shared_ptr<SphereGeometry> sphereGeo = std::make_shared<SphereGeometry>(); GeometryManager::addGeometry("sphere", sphereGeo); std::shared_ptr<CylinderGeometry> cylinderGeo = std::make_shared<CylinderGeometry>(); GeometryManager::addGeometry("cylinder2", cylinderGeo); { std::shared_ptr<Cylinder> c = std::make_shared<Cylinder>(1.f, 0.5f); std::shared_ptr<Shape> player_shape = std::make_shared<Shape>("sphere"); player_shape ->setColor(colors::light_cyan) ->setSize(glm::vec3(0.5f, 1.f, 0.5f)) ->setOffset(glm::vec3(0.f, 0.5f, 0.f)) ->setCollisionShape(c) ; m_player = std::make_shared<Entity>(player_shape); m_player->setCamera(m_cam); m_player->setMoveable(false); m_player->setPosition(glm::vec3(0.f, 32.f, 0.f)); //m_player->setPosition(glm::vec3(2.f, 0.f, 0.f)); m_world.addEntity(m_player); } m_yaw = -30; m_pitch = 15; m_roll = 0; m_iter = 4; generateTestTree(m_yaw, m_pitch, m_roll, m_iter); for (int i = 0; i < 30; ++i) { std::shared_ptr<Shape> tree = std::make_shared<Shape>(m_default_tree_geo); float r = rand() % 64 - 32; float c = rand() % 64 - 32; float h = m_hm_terrain->getHeight(r, c); tree->setPosition(glm::vec3(r, h, c)); tree->setColor(colors::light_cyan); m_hm_terrain->addShape(tree); m_trees.push_back(tree); } }
chip8emu::Chip8Emu::Chip8Emu(std::unique_ptr<chip8emu::CPU> cpu, std::shared_ptr<chip8emu::PPU> ppu, std::shared_ptr<chip8emu::Keyboard> keyboard) : mCpu(std::move(cpu)), mGfx(ppu), mKeyboard(keyboard), mPixelRects(new SDL_Rect[ppu->width()* ppu->height()]) { }
/* traverse(): */ bool MazeTraversalTremaux::traverse(int32_t startX, int32_t startY , int32_t finishX, int32_t finishY , const std::shared_ptr<maze::Maze> maze) { // std::cout << "TREMAUX: START" << std::endl; // Set Dimensions _width = maze->width(); _height = maze->height(); // Create Tremaux Cell Map _cells.reserve(maze->width() * maze->height()); for (uint32_t i = 0; i < _cells.capacity(); ++i) _cells.push_back(0); // Push Opening Cell push(startX, startY); // Loop while things remain in the stack while (! _stack.empty()) { // Set Previous Cell //previous = cell; // Get the topmost Cell maze::MazeCell cell = _stack.top(); // Get the Cell Data const maze::MazeNode & node = maze->getNode(cell.x, cell.y); // Finished ? if (node.x == finishX && node.y == finishY) break; // Determine Available Pathways std::vector<maze::MazeCell> paths; for (const maze::MazeCell & adj : node.adjacent) { TremauxCell & tremauxAdj = getCell(adj.x, adj.y); if (tremauxAdj == UNVISITED) paths.push_back(adj); } // Decide what to do from here. if (paths.size() == DEADEND) { // Is this a dead-end ?? Requires 1 adjacent cell // This is a dead-end. // Nowhere new to travel. // Backtracking // Pop the Cell pop(); } else { // Is this a Junction ?? Requires 3 or more adjacent // cells, that haven't already been travelled : Push Cell // Is this a pathway ?? Requires 2 adjacent cells // that haven't already been travelled : Push Cell // Choose which path go down int32_t index = rand() % paths.size(); push(paths[index].x, paths[index].y); } } // Path not found if (_stack.empty()) { return false; } // Backtrack along the path... while (! _stack.empty()) { // Get topmost cell maze::MazeCell & cell = _stack.top(); // Add to path list _path.insert(_path.begin(), cell); // Pop Cell _stack.pop(); } return true; }
AnimatedImage::AnimatedImage(std::shared_ptr<libfalltergeist::FrmFileType> frm, unsigned int direction) { setTexture(new Texture(frm->width(), frm->height())); _texture->loadFromRGBA(frm->rgba(ResourceManager::palFileType("color.pal"))); setXOffset(frm->offsetX(direction) + frm->shiftX(direction)); setYOffset(frm->offsetY(direction) + frm->shiftY(direction)); AnimatedPalette* palette=Game::getInstance()->animatedPalette(); auto masks = frm->animatedMasks(); if ((*masks)[libfalltergeist::FrmFileType::MASK_MONITOR] != NULL) { for (auto i=0; i<5; i++) { unsigned int* mask = new unsigned int[frm->width() * frm->height()](); //modify for (unsigned int j = 0; j< frm->width() * frm->height(); j++) { mask[j] = palette->color((*masks)[libfalltergeist::FrmFileType::MASK_MONITOR][j],i); } //set auto texture = new Texture(frm->width(), frm->height()); texture->loadFromRGBA(mask); _monitorTextures.push_back(texture); } } if ((*masks)[libfalltergeist::FrmFileType::MASK_SLIME] != NULL) { for (auto i=0; i<4; i++) { unsigned int* mask = new unsigned int[frm->width() * frm->height()](); //modify for (unsigned int j = 0; j< frm->width() * frm->height(); j++) { mask[j] = palette->color(((*masks)[libfalltergeist::FrmFileType::MASK_SLIME][j]),i); } //set auto texture = new Texture(frm->width(), frm->height()); texture->loadFromRGBA(mask); _slimeTextures.push_back(texture); } } if ((*masks)[libfalltergeist::FrmFileType::MASK_SHORE] != NULL) { for (auto i=0; i<6; i++) { unsigned int* mask = new unsigned int[frm->width() * frm->height()](); //modify for (unsigned int j = 0; j< frm->width() * frm->height(); j++) { mask[j] = palette->color(((*masks)[libfalltergeist::FrmFileType::MASK_SHORE][j]),i); } //set auto texture = new Texture(frm->width(), frm->height()); texture->loadFromRGBA(mask); _shoreTextures.push_back(texture); } } if ((*masks)[libfalltergeist::FrmFileType::MASK_FIRE_SLOW] != NULL) { for (auto i=0; i<5; i++) { unsigned int* mask = new unsigned int[frm->width() * frm->height()](); //modify for (unsigned int j = 0; j< frm->width() * frm->height(); j++) { mask[j] = palette->color(((*masks)[libfalltergeist::FrmFileType::MASK_FIRE_SLOW][j]),i); } //set auto texture = new Texture(frm->width(), frm->height()); texture->loadFromRGBA(mask); _fireSlowTextures.push_back(texture); } } if ((*masks)[libfalltergeist::FrmFileType::MASK_FIRE_FAST] != NULL) { for (auto i=0; i<5; i++) { unsigned int* mask = new unsigned int[frm->width() * frm->height()](); //modify for (unsigned int j = 0; j< frm->width() * frm->height(); j++) { mask[j] = palette->color(((*masks)[libfalltergeist::FrmFileType::MASK_FIRE_FAST][j]),i); } //set auto texture = new Texture(frm->width(), frm->height()); texture->loadFromRGBA(mask); _fireFastTextures.push_back(texture); } } if ((*masks)[libfalltergeist::FrmFileType::MASK_REDDOT] != NULL) { for (auto i=0; i<16; i++) { unsigned int* mask = new unsigned int[frm->width() * frm->height()](); //modify for (unsigned int j = 0; j< frm->width() * frm->height(); j++) { mask[j] = palette->color(((*masks)[libfalltergeist::FrmFileType::MASK_REDDOT][j]),i); } //set auto texture = new Texture(frm->width(), frm->height()); texture->loadFromRGBA(mask); _reddotTextures.push_back(texture); } } }
void TVec::setZiel(std::shared_ptr<TBuilding> build) { setZiel(build->getX() + build->width()/2, build->getY() + build->height() / 2); }
/* traverse(): */ bool MazeTraverseAStar::traverse(int32_t startX, int32_t startY , int32_t finishX, int32_t finishY , const std::shared_ptr<maze::Maze> maze) { assert(maze); _finish.x = finishX; _finish.y = finishY; // Get Maze Width _width = maze->width(); _height = maze->height(); //bool found = false; // Initialise sCell States _cells.reserve(_width * _height); for (uint32_t i = 0; i < _cells.capacity(); ++i) { AStarCell cell; //cell.queued = false; cell.visited = false; cell.pathX = -1; cell.pathY = -1; cell.bestCost = -1; _cells.push_back(cell); } // Push Starting Node pushStart(startX, startY, 0); // Continue while Nodes are still available :) while (!_queue.empty()) { // Get First Node const AStarPriority & priority = pop(); // Is this the finsh Node? Set Found Flag if (priority.x == finishX && priority.y == finishY) { // found = true; // std::cout << "ASTAR: Path is found : " << std::endl; break; } // Get Maze Node const maze::MazeNode & node = maze->getNode(priority.x, priority.y); // Push Adjacent Nodes for (const maze::MazeCell & adjacent : node.adjacent) { // Push Node Onto Queue push(priority, adjacent.x, adjacent.y, 1); } } // Build the Path Edges buildPath(); return true; }
inline unsigned width() const { return img->width(); }
bool CRNTranscoder::transcode(std::shared_ptr<render::AbstractTexture> texture, const std::string& textureType, std::shared_ptr<WriterOptions> writerOptions, render::TextureFormat outFormat, std::vector<unsigned char>& out) { #ifndef MINKO_NO_CRNLIB crnlib::console::disable_output(); const auto textureFormatToCRNTextureFomat = std::unordered_map<TextureFormat, crn_format, Hash<TextureFormat>> { { TextureFormat::RGB_DXT1, crn_format::cCRNFmtDXT1 }, { TextureFormat::RGBA_DXT1, crn_format::cCRNFmtDXT1 }, { TextureFormat::RGBA_DXT3, crn_format::cCRNFmtDXT3 }, { TextureFormat::RGBA_DXT5, crn_format::cCRNFmtDXT5 } }; const auto startTimeStamp = std::clock(); const auto generateMipmaps = writerOptions->generateMipmaps(textureType); switch (texture->type()) { case TextureType::Texture2D: { auto texture2d = std::static_pointer_cast<Texture>(texture); auto texture2dData = std::vector<unsigned char>( texture2d->data().begin(), texture2d->data().end() ); const auto useSRGBSpace = writerOptions->useTextureSRGBSpace(textureType); crn_comp_params compressorParameters; compressorParameters.m_width = texture2d->width(); compressorParameters.m_height = texture2d->height(); compressorParameters.m_pImages[0][0] = reinterpret_cast<const unsigned int*>(texture2dData.data()); compressorParameters.set_flag(cCRNCompFlagDXT1AForTransparency, outFormat == TextureFormat::RGBA_DXT1); compressorParameters.set_flag(cCRNCompFlagHierarchical, false); compressorParameters.set_flag(cCRNCompFlagPerceptual, useSRGBSpace); compressorParameters.m_file_type = cCRNFileTypeDDS; compressorParameters.m_format = textureFormatToCRNTextureFomat.at(outFormat); compressorParameters.m_dxt_compressor_type = compressorTypeFromQualityFactor( outFormat, writerOptions->compressedTextureQualityFactor(textureType) ); compressorParameters.m_dxt_quality = crn_dxt_quality::cCRNDXTQualityUber; compressorParameters.m_quality_level = cCRNMaxQualityLevel; crn_mipmap_params compressorMipParameters; compressorMipParameters.m_mode = generateMipmaps ? cCRNMipModeGenerateMips : cCRNMipModeNoMips; compressorMipParameters.m_gamma_filtering = useSRGBSpace; unsigned int actualQualityLevel; float actualBitrate; auto ddsTextureDataSize = 0u; auto ddsFileRawData = crn_compress( compressorParameters, compressorMipParameters, ddsTextureDataSize, &actualQualityLevel, &actualBitrate ); const auto width = texture->width(); const auto height = texture->height(); const auto numMipmaps = generateMipmaps ? math::getp2(texture->width()) + 1u : 0u; auto ddsFileData = reinterpret_cast<const char*>(ddsFileRawData); unsigned int ddsFilecode = 0u; memcpy(&ddsFilecode, ddsFileData, 4u); if (ddsFilecode != crnlib::cDDSFileSignature) return false; crnlib::DDSURFACEDESC2 ddsHeader; memcpy(&ddsHeader, ddsFileData + 4u, crnlib::cDDSSizeofDDSurfaceDesc2); auto mipOffset = crnlib::cDDSSizeofDDSurfaceDesc2 + 4u; for (auto i = 0u; i < numMipmaps; ++i) { const auto mipWidth = width >> i; const auto mipHeight = height >> i; const auto mipBlocksX = (mipWidth + 3) >> 2; const auto mipBlocksY = (mipHeight + 3) >> 2; const auto mipRowPitch = mipBlocksX * crnd::crnd_get_bytes_per_dxt_block(compressorParameters.m_format); const auto mipDataSize = mipRowPitch * mipBlocksY; auto mipData = std::vector<unsigned char>(mipDataSize); std::copy( ddsFileData + mipOffset, ddsFileData + mipOffset + mipDataSize, mipData.begin() ); mipOffset += mipDataSize; out.insert( out.end(), mipData.begin(), mipData.end() ); } break; } case TextureType::CubeTexture: { // TODO // handle CubeTexture return false; } } const auto duration = (std::clock() - startTimeStamp) / static_cast<double>(CLOCKS_PER_SEC); LOG_INFO("compressing texture: " << texture->width() << "x" << texture->height() << " from " << TextureFormatInfo::name(texture->format()) << " to " << TextureFormatInfo::name(outFormat) << " with duration of " << duration ); return true; #else return false; #endif }
tsTestBloom::tsTestBloom(std::shared_ptr<Application> app) : Screen(app), m_timer(0), m_disable_cam(false) { // (-) TERRAIN m_world.setTerrain(std::make_shared<FlatTerrain>()); // (-) SHADER { m_defaultShader = false; m_bloomManager = std::make_shared<HDRBloomManager>(); m_bloomManager->openGLSetup(app->width(), app->height()); } // (-) ENTITIES { std::shared_ptr<CubeGeometry> cubeGeo = std::make_shared<CubeGeometry>(); GeometryManager::addGeometry("cube", cubeGeo); std::shared_ptr<ConeGeometry> coneGeo = std::make_shared<ConeGeometry>(); GeometryManager::addGeometry("cone", coneGeo); std::shared_ptr<SphereGeometry> sphereGeo = std::make_shared<SphereGeometry>(); GeometryManager::addGeometry("sphere", sphereGeo); std::shared_ptr<CylinderGeometry> cylinderGeo = std::make_shared<CylinderGeometry>(); GeometryManager::addGeometry("cylinder2", cylinderGeo); } { std::shared_ptr<Cylinder> c = std::make_shared<Cylinder>(1.f, 0.5f); std::shared_ptr<Shape> player_shape = std::make_shared<Shape>("cylinder2"); player_shape ->setColor(colors::light_cyan) ->setSize(glm::vec3(1.f)) ->setOffset(glm::vec3(0.f, 0.5f, 0.f)) ->setCollisionShape(c) ; m_player = std::make_shared<Entity>(player_shape); m_player->setCamera(m_cam); m_player->setMoveable(false); m_player->setPosition(glm::vec3(3.f, 0.f, 0.f)); m_world.addEntity(m_player); } { std::shared_ptr<Cylinder> c = std::make_shared<Cylinder>(1.f, 0.5f); std::shared_ptr<Shape> cylinder = std::make_shared<Shape>("cube"); cylinder ->setColor(colors::light_sea_green) ->setSize(glm::vec3(1.f)) ->setOffset(glm::vec3(0.f, 0.5f, 0.f)) ->setCollisionShape(c) ; m_cube = std::make_shared<Entity>(cylinder); m_cube ->setPosition(glm::vec3(0.f, 0.f, 0.f)); m_world.addEntity(m_cube); } { std::shared_ptr<Cylinder> c = std::make_shared<Cylinder>(1.f, 0.5f); std::shared_ptr<Shape> cylinder = std::make_shared<Shape>("cone"); cylinder ->setColor(colors::linen) ->setSize(glm::vec3(1.f)) ->setOffset(glm::vec3(0.f, 0.5f, 0.f)) ->setCollisionShape(c) ; m_cone = std::make_shared<Entity>(cylinder); m_cone ->setPosition(glm::vec3(5.f, 0.f, 0.f)); m_world.addEntity(m_cone); } { std::shared_ptr<Cylinder> c = std::make_shared<Cylinder>(1.f, 0.5f); std::shared_ptr<Shape> sphere = std::make_shared<Shape>("sphere"); sphere ->setColor(glm::vec3(5.f, 10.f, 10.f)) ->setSize(glm::vec3(1.f)) ->setOffset(glm::vec3(0.f, 0.5f, 0.f)) ->setCollisionShape(c) ; m_sphere = std::make_shared<Entity>(sphere); m_sphere ->setPosition(glm::vec3(5.f, 0.f, 0.f)); m_world.addEntity(m_sphere); } }