Skip to content

Commit cabc39b

Browse files
committed
add back skybox rendering
1 parent 4e43ccf commit cabc39b

File tree

3 files changed

+40
-39
lines changed

3 files changed

+40
-39
lines changed

src/DOM/CameraAnimationDOMNode.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ namespace CameraAnimation {
3838
glBindFramebuffer(GL_FRAMEBUFFER, 0);
3939
glBindTexture(GL_TEXTURE_2D, 0);
4040
glBindRenderbuffer(GL_RENDERBUFFER, 0);
41-
42-
std::cout << mPreviewTex << std::endl;
43-
4441
}
4542

4643
void CleanupPreview(){

src/TextEditor.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -750,57 +750,57 @@ void TextEditor::HandleKeyboardInputs()
750750
io.WantCaptureKeyboard = true;
751751
io.WantTextInput = true;
752752

753-
if (!IsReadOnly() && isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Z)))
753+
if (!IsReadOnly() && isShortcut && ImGui::IsKeyPressed(ImGuiKey_Z))
754754
Undo();
755-
else if (!IsReadOnly() && isAltOnly && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Backspace)))
755+
else if (!IsReadOnly() && isAltOnly && ImGui::IsKeyPressed(ImGuiKey_Backspace))
756756
Undo();
757-
else if (!IsReadOnly() && isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Y)))
757+
else if (!IsReadOnly() && isShortcut && ImGui::IsKeyPressed(ImGuiKey_Y))
758758
Redo();
759-
else if (!IsReadOnly() && isShiftShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Z)))
759+
else if (!IsReadOnly() && isShiftShortcut && ImGui::IsKeyPressed(ImGuiKey_Z))
760760
Redo();
761-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)))
761+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_UpArrow))
762762
MoveUp(1, shift);
763-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)))
763+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_DownArrow))
764764
MoveDown(1, shift);
765-
else if ((isOSX ? !ctrl : !alt) && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)))
765+
else if ((isOSX ? !ctrl : !alt) && !super && ImGui::IsKeyPressed(ImGuiKey_LeftArrow))
766766
MoveLeft(1, shift, isWordmoveKey);
767-
else if ((isOSX ? !ctrl : !alt) && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightArrow)))
767+
else if ((isOSX ? !ctrl : !alt) && !super && ImGui::IsKeyPressed(ImGuiKey_RightArrow))
768768
MoveRight(1, shift, isWordmoveKey);
769-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageUp)))
769+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_PageUp))
770770
MoveUp(GetPageSize() - 4, shift);
771-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageDown)))
771+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_PageDown))
772772
MoveDown(GetPageSize() - 4, shift);
773-
else if (ctrl && !alt && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Home)))
773+
else if (ctrl && !alt && !super && ImGui::IsKeyPressed(ImGuiKey_Home))
774774
MoveTop(shift);
775-
else if (ctrl && !alt && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_End)))
775+
else if (ctrl && !alt && !super && ImGui::IsKeyPressed(ImGuiKey_End))
776776
MoveBottom(shift);
777-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Home)))
777+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_Home))
778778
MoveHome(shift);
779-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_End)))
779+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_End))
780780
MoveEnd(shift);
781-
else if (!IsReadOnly() && !alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete)))
781+
else if (!IsReadOnly() && !alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_Delete))
782782
Delete();
783-
else if (!IsReadOnly() && !alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Backspace)))
783+
else if (!IsReadOnly() && !alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_Backspace))
784784
Backspace();
785-
else if (!alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Insert)))
785+
else if (!alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_Insert))
786786
mOverwrite ^= true;
787-
else if (isCtrlOnly && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Insert)))
787+
else if (isCtrlOnly && ImGui::IsKeyPressed(ImGuiKey_Insert))
788788
Copy();
789-
else if (isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C)))
789+
else if (isShortcut && ImGui::IsKeyPressed(ImGuiKey_C))
790790
Copy();
791-
else if (!IsReadOnly() && isShiftOnly && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Insert)))
791+
else if (!IsReadOnly() && isShiftOnly && ImGui::IsKeyPressed(ImGuiKey_Insert))
792792
Paste();
793-
else if (!IsReadOnly() && isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_V)))
793+
else if (!IsReadOnly() && isShortcut && ImGui::IsKeyPressed(ImGuiKey_V))
794794
Paste();
795-
else if (isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_X)))
795+
else if (isShortcut && ImGui::IsKeyPressed(ImGuiKey_X))
796796
Cut();
797-
else if (isShiftOnly && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete)))
797+
else if (isShiftOnly && ImGui::IsKeyPressed(ImGuiKey_Delete))
798798
Cut();
799-
else if (isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_A)))
799+
else if (isShortcut && ImGui::IsKeyPressed(ImGuiKey_A))
800800
SelectAll();
801-
else if (!IsReadOnly() && !alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)))
801+
else if (!IsReadOnly() && !alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_Enter))
802802
EnterCharacter('\n', false);
803-
else if (!IsReadOnly() && !alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Tab)))
803+
else if (!IsReadOnly() && !alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_Tab))
804804
EnterCharacter('\t', shift);
805805
if (!IsReadOnly() && !io.InputQueueCharacters.empty() && !ctrl && !super)
806806
{

src/scene/EditorScene.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,30 @@ void LEditorScene::LoadResFromRoot(){
5858

5959
J3DModelLoader Loader;
6060

61-
/*if((std::filesystem::exists(std::filesystem::path(OPTIONS.mRootPath) / "files" / "Iwamoto" / "vrball_M.szp"))){
61+
if((std::filesystem::exists(std::filesystem::path(OPTIONS.mRootPath) / "files" / "Iwamoto" / "vrball_M.szp"))){
6262

6363
std::shared_ptr<Archive::Rarc> skyboxArchive = Archive::Rarc::Create();
6464

65-
bStream::CFileStream skyboxArchiveFile((std::filesystem::path(OPTIONS.mRootPath) / "files" / "Iwamoto" / "vrball_M.szp").string());
65+
bStream::CFileStream skyboxArchiveFile((std::filesystem::path(OPTIONS.mRootPath) / "files" / "Iwamoto" / "vrball_M.szp").string(), bStream::Endianess::Big, bStream::OpenMode::In);
6666

6767
if(!skyboxArchive->Load(&skyboxArchiveFile)){
68+
std::cout << "[EditorScene] Failed to load SkyBox Archive" << std::endl;
6869
return;
6970
}
7071

7172
std::shared_ptr<Archive::File> skyboxModelFile = skyboxArchive->GetFile("vrball01.bmd");
7273

7374
if(skyboxModelFile != nullptr){
75+
std::cout << "[EditorScene] Loaded SkyBox Model" << std::endl;
7476
bStream::CMemoryStream modelData(skyboxModelFile->GetData(), skyboxModelFile->GetSize(), bStream::Endianess::Big, bStream::OpenMode::In);
7577
mSkyboxModel = Loader.Load(&modelData, 0);
7678
mSkyBox = mSkyboxModel->CreateInstance();
79+
} else {
80+
std::cout << "[EditorScene] Failed to load SkyBox Model" << std::endl;
7781
}
78-
}*/
82+
} else {
83+
std::cout << "[EditorScene] Couldn't find Skybox archive " << (std::filesystem::path(OPTIONS.mRootPath) / "files" / "Iwamoto" / "vrball_M.szp").string() << std::endl;
84+
}
7985
}
8086

8187
void LEditorScene::Init(){
@@ -262,8 +268,6 @@ void LEditorScene::RenderSubmit(uint32_t m_width, uint32_t m_height){
262268
glm::mat4 proj = Camera.GetProjectionMatrix();
263269

264270
J3DUniformBufferObject::SetProjAndViewMatrices(proj, view);
265-
266-
// This causes the UBO to be doubole submitted, needs to be fixed. Perhaps BMD Rendering first?
267271
J3DUniformBufferObject::SubmitUBO();
268272

269273
std::vector<std::shared_ptr<J3DModelInstance>> renderables;
@@ -277,18 +281,18 @@ void LEditorScene::RenderSubmit(uint32_t m_width, uint32_t m_height){
277281
if(roomLocked->GetSkyboxEnabled() && mSkyBox != nullptr){
278282
mSkyBox->SetTranslation(roomLocked->GetPosition());
279283
mSkyBox->SetRotation({0,0,0});
280-
mSkyBox->SetScale({15,15,15});
284+
mSkyBox->SetScale({20,20,20});
281285
renderables.push_back(mSkyBox);
282286
break;
283287
}
284288
}
285289
}
286290

287-
glFrontFace(GL_CW);
291+
glDisable(GL_CULL_FACE);
288292

289293
glEnable(GL_DEPTH_TEST);
290294
glDepthFunc(GL_LEQUAL);
291-
295+
292296
glEnable(GL_BLEND);
293297
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
294298

@@ -404,9 +408,9 @@ void LEditorScene::RenderSubmit(uint32_t m_width, uint32_t m_height){
404408
mPointManager.Draw(&Camera);
405409
mPathRenderer.Draw(&Camera);
406410

407-
auto packets = J3D::Rendering::SortPackets(renderables, Camera.GetCenter());
408411

409-
J3D::Rendering::Render(0, view, proj, packets);
412+
auto packets = J3D::Rendering::SortPackets(renderables, Camera.GetCenter());
413+
J3D::Rendering::Render(1, view, proj, packets);
410414
}
411415

412416
bool LEditorScene::HasRoomLoaded(int32_t roomNumber){

0 commit comments

Comments
 (0)