Commit ee7f565f authored by 魔大农's avatar 魔大农

Added leafy spot

parent 635b3106
......@@ -23,8 +23,7 @@ SOURCES += \
quattercam.cpp \
board.cpp \
piece.cpp \
master.cpp \
squarepicker.cpp
master.cpp
HEADERS += \
luckey.h \
......@@ -33,5 +32,4 @@ HEADERS += \
quattercam.h \
board.h \
piece.h \
master.h \
squarepicker.h
master.h
# [:four_leaf_clover:](http://www.luckeyproductions.nl/) Quatter
A digital version of [the Quarto boardgame](https://en.wikipedia.org/wiki/Quarto_%28board_game%29) by Blaise Müller, made using the [Urho3D](http://urho3d.github.io) game engine and other open source software.
![Screenshot](https://raw.githubusercontent.com/LucKeyProductions/Quatter/master/Screenshots/Screenshot_Wed_May_25_10_10_24_2016.png)
![Screenshot](https://raw.githubusercontent.com/LucKeyProductions/Quatter/master/Screenshots/Screenshot_Wed_May_25_13_19_10_2016.png)
Background image by [Greg Zaal](http://adaptivesamples.com)
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0"?>
<material>
<technique name="Techniques/DiffNormalEnvCube.xml" quality="1" loddistance="0" />
<texture unit="diffuse" name="Textures/BoardDiffuse.png" />
<texture unit="normal" name="Textures/BoardNormal.png" />
<texture unit="specular" name="Textures/BoardSpecular.png" />
<texture unit="diffuse" name="Textures/BoardDiffuse.dds" />
<texture unit="normal" name="Textures/BoardNormal.dds" />
<texture unit="specular" name="Textures/BoardSpecular.dds" />
<texture unit="environment" name="Textures/LeafyKnoll.xml" />
<parameter name="UOffset" value="1 0 0 0" />
<parameter name="VOffset" value="0 1 0 0" />
......
<?xml version="1.0"?>
<material>
<technique name="Techniques/DiffSkybox.xml" quality="0" loddistance="0" />
<texture unit="diffuse" name="Textures/LeafyKnollPng.xml" />
<texture unit="diffuse" name="Textures/LeafyKnoll.xml" />
<parameter name="UOffset" value="1 0 0 0" />
<parameter name="VOffset" value="0 1 0 0" />
<parameter name="MatDiffColor" value="0.666 0.666 0.666 1" />
......
......@@ -6,5 +6,5 @@
<texture unit="environment" name="Textures/LeafyKnoll.xml" />
<parameter name="MatDiffColor" value="1.0 0.0 0.0 1" />
<parameter name="MatEnvMapColor" value="0.08 0.1 0.08" />
<parameter name="MatSpecColor" value="0.08 0.08 0.13 10" />
<parameter name="MatSpecColor" value="0.23 0.23 0.27 23" />
</material>
\ No newline at end of file
This diff is collapsed.
......@@ -2,6 +2,7 @@
#include "inputmaster.h"
#include "quattercam.h"
#include "board.h"
#include <Urho3D/Graphics/Texture2D.h>
URHO3D_DEFINE_APPLICATION_MAIN(MasterControl);
......@@ -85,6 +86,7 @@ void MasterControl::CreateScene()
tableModel->SetModel(GetModel("Table"));
tableModel->SetMaterial(GetMaterial("Table"));
tableModel->GetMaterial()->SetShaderParameter("MatDiffColor", Vector4(0.32f, 0.40f, 0.42f, 1.0f));
tableModel->SetCastShadows(true);
//Create board and pieces
world.board_ = new Board();
......@@ -99,27 +101,44 @@ void MasterControl::CreateScene()
void MasterControl::CreateLights()
{
//Add a directional light to the world. Enable cascaded shadows on it
//Add main light source
Node* downardsLightNode{world.scene->CreateChild("DirectionalLight")};
downardsLightNode->SetPosition(Vector3(2.0f, 23.0f, -3.0f));
downardsLightNode->SetPosition(Vector3(2.0f, 23.0f, 3.0f));
downardsLightNode->LookAt(Vector3(0.0f, 0.0f, 0.0f));
Light* downwardsLight{downardsLightNode->CreateComponent<Light>()};
downwardsLight->SetLightType(LIGHT_DIRECTIONAL);
downwardsLight->SetBrightness(0.8f);
downwardsLight->SetBrightness(0.5f);
downwardsLight->SetColor(Color(0.8f, 0.9f, 0.95f));
downwardsLight->SetCastShadows(true);
downwardsLight->SetShadowIntensity(0.23f);
downwardsLight->SetShadowBias(BiasParameters(0.000025f, 0.5f));
downwardsLight->SetShadowCascade(CascadeParameters(1.0f, 5.0f, 23.0f, 100.0f, 0.8f));
downwardsLight->SetShadowCascade(CascadeParameters(5.0f, 7.0f, 23.0f, 42.0f, 0.8f));
//Add a directional light to the world. Enable cascaded shadows on it
leafyLightNode_ = world.scene->CreateChild("DirectionalLight");
leafyLightNode_->SetPosition(Vector3(6.0f, 96.0f, 9.0f));
leafyLightNode_->LookAt(Vector3(0.0f, 0.0f, 0.0f));
leafyLight_ = leafyLightNode_->CreateComponent<Light>();
leafyLight_->SetLightType(LIGHT_SPOT);
// leafyLight_->SetBrightness(1.0f);
leafyLight_->SetRange(180.0f);
leafyLight_->SetFov(34.0f);
leafyLight_->SetCastShadows(true);
leafyLight_->SetShapeTexture(static_cast<Texture*>(cache_->GetResource<Texture2D>("Textures/LeafyMask.png")));
leafyLight_->SetShadowBias(BiasParameters(0.0000025f, 0.5f));
leafyLight_->SetShadowCascade(CascadeParameters(5.0f, 7.0f, 23.0f, 42.0f, 0.8f));
leafyLight_->SetShadowCascade(CascadeParameters(64.0f, 86.0f, 128.0f, 192.0f, 0.8f));
//Create a point light.
Node* pointLightNode_{world.scene->CreateChild("PointLight")};
pointLightNode_->SetPosition(Vector3(-10.0f, -1.0f, 23.0f));
pointLightNode_->SetPosition(Vector3(-10.0f, 5.0f, -23.0f));
Light* pointLight{pointLightNode_->CreateComponent<Light>()};
pointLight->SetLightType(LIGHT_POINT);
pointLight->SetBrightness(0.42f);
pointLight->SetRange(42.0f);
pointLight->SetColor(Color(0.75f, 1.0f, 0.75f));
pointLight->SetCastShadows(true);
pointLight->SetShadowIntensity(0.8f);
}
Piece* MasterControl::GetSelectedPiece() const
......@@ -164,6 +183,10 @@ void MasterControl::HandleUpdate(StringHash eventType, VariantMap& eventData)
}
}
}
//Wave leafy light
leafyLightNode_->SetRotation(Quaternion(Sine(Sine(0.1f, 0.05f, 0.23f), -0.23f, 0.23f) + 90.0f, Vector3::RIGHT) *
Quaternion(Sine(0.23f, 178.0f, 182.0f), Vector3::FORWARD));
leafyLight_->SetBrightness(Sine(0.011f, 0.05f, 0.5f) + Sine(0.02f, 0.13f, 0.34f));
}
void MasterControl::NextPhase()
......
......@@ -71,6 +71,7 @@ public:
Material* GetMaterial(String name) const { return cache_->GetResource<Material>("Materials/"+name+".xml"); }
Model* GetModel(String name) const { return cache_->GetResource<Model>("Models/"+name+".mdl"); }
Texture* GetTexture(String name) const { return cache_->GetResource<Texture>("Textures/"+name+".png"); }
float Sine(const float freq, const float min, const float max, const float shift = 0.0f);
......@@ -78,6 +79,8 @@ public:
private:
static MasterControl* instance_;
InputMaster* inputMaster_;
SharedPtr<Node> leafyLightNode_;
SharedPtr<Light> leafyLight_;
SharedPtr<SoundSource> musicSource_;
float musicGain_;
......
......@@ -45,8 +45,8 @@ void QuatterCam::SetupViewport()
effectRenderPath_->Append(MC->cache_->GetResource<XMLFile>("PostProcess/FXAA3.xml"));
effectRenderPath_->SetEnabled("FXAA3", true);
effectRenderPath_->Append(MC->cache_->GetResource<XMLFile>("PostProcess/BloomHDR.xml"));
effectRenderPath_->SetShaderParameter("BloomHDRThreshold", 0.42f);
effectRenderPath_->SetShaderParameter("BloomHDRMix", Vector2(1.0f, 1.0f));
effectRenderPath_->SetShaderParameter("BloomHDRThreshold", 0.4f);
effectRenderPath_->SetShaderParameter("BloomHDRMix", Vector2(1.0f, 1.25f));
effectRenderPath_->SetEnabled("BloomHDR", true);
Renderer* renderer{GetSubsystem<Renderer>()};
......@@ -68,8 +68,8 @@ void QuatterCam::HandleSceneUpdate(StringHash eventType, VariantMap& eventData)
pockets_.first_->Rotate(Quaternion(t * spinSpeed, Vector3::UP));
pockets_.second_->Rotate(Quaternion(-t * spinSpeed, Vector3::UP));
//Reposition pockets
pockets_.first_->SetPosition(Vector3(-2.3f - 0.06f * (ZOOM_MAX - distance_), 1.5f, 3.2f));
pockets_.second_->SetPosition(Vector3(2.3f + 0.06f * (ZOOM_MAX - distance_), 1.5f, 3.2f));
pockets_.first_->SetPosition(Vector3(-2.2f - 0.06f * (ZOOM_MAX - distance_), 1.4f, 3.2f));
pockets_.second_->SetPosition(Vector3(2.2f + 0.06f * (ZOOM_MAX - distance_), 1.4f, 3.2f));
}
void QuatterCam::Rotate(Vector2 rotation)
......
#include "squarepicker.h"
SquarePicker::SquarePicker() : Object(MC->GetContext())
{
node_ = MC->world.scene->CreateChild("SquarePicker");
}
#ifndef SQUAREPICKER_H
#define SQUAREPICKER_H
#include <Urho3D/Urho3D.h>
#include "mastercontrol.h"
using namespace Urho3D;
class SquarePicker : public Object
{
URHO3D_OBJECT(SquarePicker, Object);
public:
SquarePicker();
private:
SharedPtr<Node> node_;
SharedPtr<StaticModel> model_;
};
#endif // SQUAREPICKER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment