Try to clean up asset folders for sample apps. (#128)
* Try to clean up asset folders for sample apps. This removes the build step where we copy a subset of assets, and makes it so that FilamentApp hands out a "root path" for assets. For now this is determined based on the location of the executable. This allows developers to launch samples from any CWD. Closes #11 * Restore asset copy to build.
This commit is contained in:
@@ -81,14 +81,13 @@ int main() {
|
||||
auto setup = [&app](Engine* engine, View* view, Scene* scene) {
|
||||
|
||||
// Load texture
|
||||
Path path = Path::getCurrentExecutable().getParent() +
|
||||
"textures/Moss_01/Moss_01_Color.png";
|
||||
Path path = FilamentApp::getRootPath() + "third_party/textures/Moss_01/Moss_01_Color.png";
|
||||
if (!path.exists()) {
|
||||
std::cerr << "The texture " << path << " does not exist" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
int w, h, n;
|
||||
unsigned char* data = stbi_load(path.getAbsolutePath().c_str(), &w, &h, &n, 4);
|
||||
unsigned char* data = stbi_load(path.c_str(), &w, &h, &n, 4);
|
||||
if (data == nullptr) {
|
||||
std::cerr << "The texture " << path << " could not be loaded" << std::endl;
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user