Files
filament/samples/app/IBL.h
Philip Rideout af799e734a FilamentApp can now use KTX environments.
When cmgen creates ktx files, it creates a pair: one with an _ibl suffix
and one with _skybox. This convention is now honored by FilamentApp.

Note that we already have several KTX environments in the repo, so you
can clone a fresh repo and do:

  gltf_viewer --ibl={FILAMENT}/docs/webgl/pillars_2k DamagedHelmet.gltf

Note that we have several hundred files in samples/envs, we should
consider replacing those or copying the environments in docs/webgl
(which git would internally de-dup, due to content hashing).
2018-11-30 14:09:04 -08:00

70 lines
1.7 KiB
C++

/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TNT_FILAMENT_SAMPLE_IBL_H
#define TNT_FILAMENT_SAMPLE_IBL_H
#include <math/vec3.h>
#include <string>
namespace filament {
class Engine;
class IndexBuffer;
class IndirectLight;
class Material;
class MaterialInstance;
class Renderable;
class Texture;
class Skybox;
}
namespace utils {
class Path;
}
class IBL {
public:
explicit IBL(filament::Engine& engine);
~IBL();
bool loadFromDirectory(const utils::Path& path);
bool loadFromKtx(const std::string& prefix);
filament::IndirectLight* getIndirectLight() const noexcept {
return mIndirectLight;
}
filament::Skybox* getSkybox() const noexcept {
return mSkybox;
}
private:
bool loadCubemapLevel(filament::Texture** texture, const utils::Path& path,
size_t level = 0, std::string const& levelPrefix = "") const;
filament::Engine& mEngine;
math::float3 mBands[9] = {};
filament::Texture* mTexture = nullptr;
filament::IndirectLight* mIndirectLight = nullptr;
filament::Texture* mSkyboxTexture = nullptr;
filament::Skybox* mSkybox = nullptr;
};
#endif // TNT_FILAMENT_SAMPLE_IBL_H