-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
175 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[base] | ||
albedo = 0.5, 0.5, 0.5 | ||
roughness = 0.9 | ||
|
||
[textures] | ||
custom = postules.png | ||
|
||
[render] | ||
shader = plague.glsl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[base] | ||
albedo = 1, 0.75, 0.8 | ||
roughness = 0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[] | ||
Rat.glb?Cylinder-0_Pink | ||
Rat.glb?Cylinder-1_Grey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
$include /cage/shader/shaderConventions.h | ||
|
||
$include /cage/shader/engine/vertex.glsl | ||
|
||
void main() | ||
{ | ||
updateVertex(); | ||
} | ||
|
||
$include /cage/shader/engine/fragment.glsl | ||
|
||
layout(binding = CAGE_SHADER_TEXTURE_CUSTOM) uniform sampler2D texPostules; | ||
|
||
void main() | ||
{ | ||
#ifndef DepthOnly | ||
updateNormal(); | ||
Material material = loadMaterial(); | ||
float postule = texture(texPostules, varUv.xy).r; | ||
material.albedo = mix(material.albedo, vec3(0.5, 1, 0), postule); | ||
outColor = lighting(material); | ||
#endif // DepthOnly | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[] | ||
scheme = model | ||
bones = true | ||
trianglesOnly = true | ||
scale = 0.2 | ||
axes = -x+y-z | ||
Rat.glb?Cylinder-0_Pink | ||
Rat.glb?Cylinder-1_Grey | ||
|
||
[] | ||
scheme = skeleton | ||
Rat.glb;skeleton | ||
|
||
[] | ||
scheme = animation | ||
Rat.glb?Rat_Death | ||
Rat.glb?Rat_Idle | ||
Rat.glb?Rat_Jump | ||
Rat.glb?Rat_Walk | ||
|
||
[] | ||
scheme = object | ||
Rat.object | ||
|
||
[] | ||
scheme = shader | ||
plague.glsl | ||
|
||
[] | ||
scheme = texture | ||
postules.png | ||
|
||
[] | ||
scheme = pack | ||
rat.pack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[] | ||
Rat.glb;skeleton | ||
Rat.glb?Cylinder-0_Pink | ||
Rat.glb?Cylinder-1_Grey | ||
Rat.glb?Rat_Death | ||
Rat.glb?Rat_Idle | ||
Rat.glb?Rat_Jump | ||
Rat.glb?Rat_Walk | ||
Rat.object | ||
|
||
/cage-tests/skeletons/floor/floor.pack |
Submodule cage
updated
41 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#include <cage-core/assetManager.h> | ||
#include <cage-core/entities.h> | ||
#include <cage-core/hashString.h> | ||
#include <cage-core/logger.h> | ||
#include <cage-engine/highPerformanceGpuHint.h> | ||
#include <cage-engine/scene.h> | ||
#include <cage-engine/window.h> | ||
#include <cage-simple/engine.h> | ||
#include <cage-simple/fpsCamera.h> | ||
#include <cage-simple/statisticsGui.h> | ||
|
||
using namespace cage; | ||
constexpr uint32 AssetsName = HashString("cage-tests/plagueRat/rat.pack"); | ||
|
||
int main(int argc, char *args[]) | ||
{ | ||
try | ||
{ | ||
// log to console | ||
Holder<Logger> log1 = newLogger(); | ||
log1->format.bind<logFormatConsole>(); | ||
log1->output.bind<logOutputStdOut>(); | ||
|
||
engineInitialize(EngineCreateConfig()); | ||
|
||
// events | ||
//const auto updateListener = controlThread().update.listen(&update); | ||
const auto closeListener = engineWindow()->events.listen(inputFilter([](input::WindowClose) { engineStop(); })); | ||
|
||
// window | ||
engineWindow()->setMaximized(); | ||
engineWindow()->title("plague rat (test custom texture)"); | ||
|
||
// entities | ||
EntityManager *ents = engineEntities(); | ||
{ // camera | ||
Entity *e = ents->create(1); | ||
e->value<TransformComponent>().position = Vec3(0, 3, 7); | ||
e->value<TransformComponent>().orientation = Quat(Degs(-20), Degs(), Degs()); | ||
CameraComponent &c = e->value<CameraComponent>(); | ||
c.near = 0.1; | ||
c.far = 1000; | ||
c.ambientColor = Vec3(1); | ||
c.ambientIntensity = 0.2; | ||
} | ||
{ // sun | ||
Entity *e = ents->createUnique(); | ||
TransformComponent &t = e->value<TransformComponent>(); | ||
t.orientation = Quat(Degs(-50), Degs(270), Degs()); | ||
t.position = Vec3(0, 2, 0); | ||
LightComponent &l = e->value<LightComponent>(); | ||
l.lightType = LightTypeEnum::Directional; | ||
l.color = Vec3(1); | ||
l.intensity = 1; | ||
ShadowmapComponent &s = e->value<ShadowmapComponent>(); | ||
s.resolution = 2048; | ||
s.directionalWorldSize = 15; | ||
} | ||
{ // floor | ||
Entity *e = ents->createUnique(); | ||
e->value<TransformComponent>().position = Vec3(); | ||
e->value<RenderComponent>().object = HashString("cage-tests/skeletons/floor/floor.obj"); | ||
} | ||
{ // the rat | ||
Entity *e = ents->createAnonymous(); | ||
e->value<TransformComponent>().position = Vec3(0, 0, 0); | ||
e->value<TransformComponent>().orientation = Quat({}, Degs(180), {}); | ||
e->value<RenderComponent>().object = HashString("cage-tests/plagueRat/Rat.object"); | ||
e->value<SkeletalAnimationComponent>().name = HashString("cage-tests/plagueRat/Rat.glb?Rat_Walk"); | ||
} | ||
|
||
Holder<FpsCamera> cameraCtrl = newFpsCamera(ents->get(1)); | ||
cameraCtrl->mouseButton = MouseButtonsFlags::Left; | ||
cameraCtrl->movementSpeed = 0.3; | ||
Holder<StatisticsGui> statistics = newStatisticsGui(); | ||
|
||
engineAssets()->load(AssetsName); | ||
engineRun(); | ||
engineAssets()->unload(AssetsName); | ||
engineFinalize(); | ||
|
||
return 0; | ||
} | ||
catch (...) | ||
{ | ||
detail::logCurrentCaughtException(); | ||
return 1; | ||
} | ||
} |