-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic materials scene renderer proj #428
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# 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 | ||
# | ||
# https://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. | ||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR) | ||
|
||
project(31_gltf_basic_materials) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can remove 31_ |
||
|
||
add_samples_for_all_apis( | ||
NAME ${PROJECT_NAME} | ||
SOURCES | ||
"GltfBasicMaterials.h" | ||
"GltfBasicMaterials.cpp" | ||
"main.cpp" | ||
SHADER_DEPENDENCIES | ||
"shader_scene_renderer_vertex_material_vertex" | ||
"shader_scene_renderer_material_error" | ||
"shader_scene_renderer_material_debug" | ||
"shader_scene_renderer_material_unlit" | ||
"shader_scene_renderer_material_standard" | ||
) |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// 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 | ||
// | ||
// https://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 GLTF_BASIC_MATERIALS_H | ||
#define GLTF_BASIC_MATERIALS_H | ||
|
||
#include "ppx/ppx.h" | ||
#include "ppx/scene/scene_material.h" | ||
#include "ppx/scene/scene_mesh.h" | ||
#include "ppx/scene/scene_pipeline_args.h" | ||
|
||
#include <unordered_map> | ||
|
||
class GltfBasicMaterialsApp | ||
: public ppx::Application | ||
{ | ||
public: | ||
virtual void Config(ppx::ApplicationSettings& settings) override; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: virtual is implied by override and can be removed |
||
virtual void Setup() override; | ||
virtual void Shutdown() override; | ||
virtual void Render() override; | ||
|
||
private: | ||
struct PerFrame | ||
{ | ||
ppx::grfx::CommandBufferPtr cmd; | ||
ppx::grfx::SemaphorePtr imageAcquiredSemaphore; | ||
ppx::grfx::FencePtr imageAcquiredFence; | ||
ppx::grfx::SemaphorePtr renderCompleteSemaphore; | ||
ppx::grfx::FencePtr renderCompleteFence; | ||
}; | ||
|
||
std::vector<PerFrame> mPerFrame; | ||
ppx::grfx::ShaderModulePtr mVS; | ||
ppx::grfx::ShaderModulePtr mPS; | ||
ppx::grfx::PipelineInterfacePtr mPipelineInterface; | ||
ppx::grfx::GraphicsPipelinePtr mStandardMaterialPipeline = nullptr; | ||
ppx::grfx::GraphicsPipelinePtr mUnlitMaterialPipeline = nullptr; | ||
ppx::grfx::GraphicsPipelinePtr mErrorMaterialPipeline = nullptr; | ||
|
||
ppx::scene::Scene* mScene = nullptr; | ||
ppx::scene::MaterialPipelineArgs* mPipelineArgs = nullptr; | ||
|
||
std::unordered_map<const ppx::scene::Material*, uint32_t> mMaterialIndexMap; | ||
std::unordered_map<const ppx::scene::Material*, ppx::grfx::GraphicsPipeline*> mMaterialPipelineMap; | ||
|
||
ppx::grfx::TexturePtr mIBLIrrMap; | ||
ppx::grfx::TexturePtr mIBLEnvMap; | ||
}; | ||
|
||
#endif // GLTF_BASIC_MATERIALS_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2023 Google LLC | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2024 |
||
// | ||
// 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 | ||
// | ||
// https://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. | ||
|
||
#include "GltfBasicMaterials.h" | ||
|
||
SETUP_APPLICATION(GltfBasicMaterialsApp) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"abandoned_workshop_02_4k_irr.hdr" "abandoned_workshop_02_4k_env.hdr" 4096 2048 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024