Texture2D::Texture2D(std::string name): bfr(GL_TEXTURE_2D), texUnit(nullptr), texType(TextureType::NONE) { init(TextureConfig(name,GL_RGB,GL_RGB,GL_UNSIGNED_BYTE)); }
HDRScene::HDRScene(Context * ctx): camera(ctx->getWindowWidth(),ctx->getWindowHeight()), woodTex(TextureConfig("assets/textures/wood.png",GL_SRGB,GL_RGB,GL_UNSIGNED_BYTE), 64.0f, TextureConfig("assets/textures/solid_black.png")) { tunnel.transform.setScale(glm::vec3(5.0f, 5.0f, 55.0f)); tunnel.transform.translate(glm::vec3(0.0,0.0,25.0)); hdrExposureProg = createProgram("Phong lighting program"); hdrPostProcessProg = createProgram("HDR Postprocessing program"); FramebufferConfiguration config(ctx->getWindowWidth(),ctx->getWindowHeight()); TextureAttachment attachment(TextureConfig("color",GL_RGB16F,GL_RGB,GL_FLOAT),GL_COLOR_ATTACHMENT0); config.addTexturebuffer(attachment); config.addRenderbuffer(RenderbufferAttachment(GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL_ATTACHMENT)); framebuffer.init(config); }
bool StateTracker::Initialize() { // Create a dummy texture which can be used in place of a real binding. m_dummy_texture = VKTexture::Create(TextureConfig(1, 1, 1, 1, 1, AbstractTextureFormat::RGBA8, 0)); if (!m_dummy_texture) return false; // Initialize all samplers to point by default for (size_t i = 0; i < NUM_PIXEL_SHADER_SAMPLERS; i++) { m_bindings.samplers[i].imageLayout = VK_IMAGE_LAYOUT_UNDEFINED; m_bindings.samplers[i].imageView = m_dummy_texture->GetView(); m_bindings.samplers[i].sampler = g_object_cache->GetPointSampler(); } // Default dirty flags include all descriptors InvalidateCachedState(); return true; }