forked from townforge/townforge
add procsky (disabled)
It looks nice, but is very slow, might be usable as an option
This commit is contained in:
parent
6be9b4f646
commit
b8cb90311b
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -18,3 +18,6 @@
|
||||
[submodule "external/urho3d"]
|
||||
path = external/urho3d
|
||||
url = https://github.com/urho3d/Urho3D
|
||||
[submodule "external/procsky"]
|
||||
path = external/procsky
|
||||
url = https://github.com/jforjustin/ProcSky
|
||||
|
3
external/CMakeLists.txt
vendored
3
external/CMakeLists.txt
vendored
@ -103,4 +103,5 @@ set_target_properties(urho3d PROPERTIES
|
||||
)
|
||||
set(URHO3D_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/urho3d/lib/${CMAKE_STATIC_LIBRARY_PREFIX}Urho3D${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
add_dependencies(urho3d urho3d_ext)
|
||||
>>>>>>> add urho3d submodule
|
||||
|
||||
add_subdirectory(procsky)
|
||||
|
1
external/procsky
vendored
Submodule
1
external/procsky
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 7169be2312a9d24a7ba61707790581630e9a0246
|
@ -66,6 +66,7 @@ monero_add_executable(game
|
||||
# these aren't seen if set in external/CMakeLists.txt
|
||||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/external/urho3d/Source")
|
||||
set(URHO3D_LIBRARY "${CMAKE_BINARY_DIR}/external/urho3d/lib/${CMAKE_STATIC_LIBRARY_PREFIX}Urho3D${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/external/procsky")
|
||||
target_link_libraries(game
|
||||
PRIVATE
|
||||
wallet
|
||||
@ -74,6 +75,7 @@ target_link_libraries(game
|
||||
cncrypto
|
||||
common
|
||||
version
|
||||
procsky
|
||||
${URHO3D_LIBRARY}
|
||||
${Boost_CHRONO_LIBRARY}
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <Urho3D/UI/FileSelector.h>
|
||||
#include <Urho3D/UI/MessageBox.h>
|
||||
#include <Urho3D/UI/UIEvents.h>
|
||||
#include "ProcSky.h"
|
||||
#include "cryptonote_basic/cryptonote_format_utils.h"
|
||||
#include "citymesh-urho3d.h"
|
||||
#include "ui-urho3d.h"
|
||||
@ -32,6 +33,8 @@
|
||||
#include "game-wallet.h"
|
||||
#include "undo.h"
|
||||
|
||||
// #define USE_PROC_SKY
|
||||
|
||||
using namespace Urho3D;
|
||||
|
||||
const float TOUCH_SENSITIVITY = 2.0f;
|
||||
@ -267,6 +270,8 @@ void CryptoCityUrho3D::Setup(void)
|
||||
engineParameters_[EP_RESOURCE_PREFIX_PATHS] = paths.c_str();
|
||||
if (!engineParameters_.Contains(EP_RESOURCE_PATHS))
|
||||
engineParameters_[EP_RESOURCE_PATHS] = "CoreData;Data;GameData;";
|
||||
|
||||
context_->RegisterFactory<ProcSky>();
|
||||
}
|
||||
|
||||
void CryptoCityUrho3D::Start()
|
||||
@ -295,12 +300,12 @@ void CryptoCityUrho3D::Start()
|
||||
// Subscribe scene update event
|
||||
SubscribeToEvent(E_SCENEUPDATE, URHO3D_HANDLER(CryptoCityUrho3D, HandleSceneUpdate));
|
||||
|
||||
// Create the scene content
|
||||
CreateScene();
|
||||
|
||||
// Setup the viewport for displaying the scene
|
||||
SetupViewport();
|
||||
|
||||
// Create the scene content
|
||||
CreateScene();
|
||||
|
||||
SetupUI();
|
||||
|
||||
LoadEffects();
|
||||
@ -521,7 +526,10 @@ void CryptoCityUrho3D::CreateScene()
|
||||
auto* cache = GetSubsystem<ResourceCache>();
|
||||
|
||||
if (!scene_)
|
||||
{
|
||||
scene_ = new Scene(context_);
|
||||
viewport->SetScene(scene_);
|
||||
}
|
||||
else
|
||||
{
|
||||
scene_->Clear();
|
||||
@ -591,17 +599,44 @@ void CryptoCityUrho3D::CreateScene()
|
||||
printf("%d plots, origin %u %u\n", plots, ox, oy);
|
||||
#endif
|
||||
|
||||
#ifdef USE_PROC_SKY
|
||||
Renderer* renderer(GetSubsystem<Renderer>());
|
||||
Viewport *viewport = renderer->GetViewport(0);
|
||||
auto *rPath_ = viewport->GetRenderPath();
|
||||
|
||||
Node* skyNode = scene_->CreateChild("Sky");
|
||||
auto* sky = skyNode->CreateComponent<ProcSky>();
|
||||
sky->Initialize();
|
||||
sky->SetRenderSize(500);
|
||||
sky->SetUpdateAuto(true);
|
||||
#else
|
||||
Node* skyNode = scene_->CreateChild("Sky");
|
||||
skyNode->SetScale(500.0f); // The scale actually does not matter
|
||||
auto* skybox = skyNode->CreateComponent<Skybox>();
|
||||
skybox->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
|
||||
skybox->SetMaterial(cache->GetResource<Material>("Materials/CryptoCitySkybox.xml"));
|
||||
#endif
|
||||
|
||||
// add the city mesh
|
||||
cityNode = scene_->CreateChild("City");
|
||||
cityMesh = new CityMeshUrho3D(cityNode, &gameState.cityState, &map);
|
||||
cityMesh->buildMap();
|
||||
|
||||
#if 0
|
||||
// attach a light to the camera
|
||||
light = cameraNode_->CreateChild()->CreateComponent<Light>();
|
||||
light->SetLightType(LIGHT_POINT);
|
||||
//light->SetColor(Color(1.f, .0f, .0f));
|
||||
//light->SetSpecularIntensity(.2f);
|
||||
//light->SetRange(80);
|
||||
light->SetCastShadows(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CryptoCityUrho3D::SetupViewport()
|
||||
{
|
||||
auto* renderer = GetSubsystem<Renderer>();
|
||||
|
||||
// Create the camera. Create it outside the scene so that we can clear the whole scene without affecting it
|
||||
if (!cameraNode_)
|
||||
{
|
||||
@ -612,19 +647,6 @@ printf("%d plots, origin %u %u\n", plots, ox, oy);
|
||||
camera->SetFarClip(300.0f);
|
||||
}
|
||||
|
||||
// attach a light to the camera
|
||||
light = cameraNode_->CreateChild()->CreateComponent<Light>();
|
||||
light->SetLightType(LIGHT_POINT);
|
||||
//light->SetColor(Color(1.f, .0f, .0f));
|
||||
//light->SetSpecularIntensity(.2f);
|
||||
//light->SetRange(80);
|
||||
light->SetCastShadows(false);
|
||||
}
|
||||
|
||||
void CryptoCityUrho3D::SetupViewport()
|
||||
{
|
||||
auto* renderer = GetSubsystem<Renderer>();
|
||||
|
||||
// Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
|
||||
viewport = new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>());
|
||||
renderer->SetViewport(0, viewport);
|
||||
|
Loading…
Reference in New Issue
Block a user