Skip to content

Commit

Permalink
Merge branch 'release/1.6.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bam4d committed Dec 10, 2022
2 parents a8d490c + dbe5836 commit 11f6432
Show file tree
Hide file tree
Showing 42 changed files with 204 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. mac/linux/windows]
- Version [e.g. 1.6.1]
- Version [e.g. 1.6.2]

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.18.0)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
project(Griddly VERSION 1.6.1)
project(Griddly VERSION 1.6.2)

string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)

Expand Down
2 changes: 1 addition & 1 deletion bindings/python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace griddly {

PYBIND11_MODULE(python_griddly, m) {
m.doc() = "Griddly python bindings";
m.attr("version") = "1.6.1";
m.attr("version") = "1.6.2";

#ifndef NDEBUG
spdlog::set_level(spdlog::level::debug);
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Chris Bamford'

# The full version, including alpha/beta/rc tags
release = '1.6.1'
release = '1.6.2'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/GDY/Actions/items/Trigger/Offset/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Offset

* - **Type**
- **Description**
* - :ref:`Offset Coordinate<#/properties/Objects/items/properties/Observers/properties/Isometric/properties/Offset/item>`
* - :ref:`Offset Coordinate<#/properties/Objects/items/properties/Trigger/properties/Offset/item>`
- Offset Coordinate


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _#/properties/Objects/items/properties/Observers/properties/Isometric/properties/Offset/item:
.. _#/properties/Objects/items/properties/Trigger/properties/Offset/item:

.. #/properties/Objects/items/properties/Observers/properties/Isometric/properties/Offset/item
.. #/properties/Objects/items/properties/Trigger/properties/Offset/item
Offset Coordinate
=================
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/Custom Shaders/Global Lighting/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ We calculate the lighting level in the vertex shader (so we don't need to calcul
layout(std140, binding = 1) uniform EnvironmentData {
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/Custom Shaders/Health Bars/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ How this ties in with the explanation of the normalized health calculations can
layout(std140, binding = 1) uniform EnvironmentData {
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorials/Custom Shaders/Object Lighting/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ Vertex
layout(std140, binding = 1) uniform EnvironmentData {
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down Expand Up @@ -264,6 +265,7 @@ Fragment
layout(std140, binding = 1) uniform EnvironmentData {
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/Custom Shaders/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ The full shader layout is shown below.:
layout(std140, binding = 1) uniform EnvironmentData {
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
2 changes: 1 addition & 1 deletion js/griddlyjs-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "griddlyjs-app",
"version": "1.6.1",
"version": "1.6.2",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct ObjectData{
layout(std140,binding=1)uniform EnvironmentData{
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct ObjectData{
layout(std140,binding=1)uniform EnvironmentData{
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct ObjectData{
layout(std140,binding=1)uniform EnvironmentData{
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct ObjectData{
layout(std140,binding=1)uniform EnvironmentData{
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def griddly_package_data(config='Debug'):

setup(
name='griddly',
version="1.6.1",
version="1.6.2",
author_email="chrisbam4d@gmail.com",
description="Griddly Python Libraries",
long_description=long_description,
Expand Down
34 changes: 32 additions & 2 deletions resources/gdy-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,21 @@
"default": "NONE",
"enum": ["NONE", "GRAYSCALE", "DARKEN", "REMOVE"],
"description": "The type of trigger to use."
},
"ObserverAvatarHighlightColor": {
"$id": "#/properties/Environment/properties/Observers/properties/Shader/properties/ObserverAvatarHighlightColor",
"type": "array",
"title": "Color",
"description": "The color of the highlighting to use",
"additionalItems": false,
"minItems": 3,
"maxItems": 3,
"items": {
"$id": "#/properties/Objects/items/properties/Observers/properties/BackgroundColor/item",
"type": "number",
"title": "Color value",
"description": "A float value for RGB"
}
}
}
},
Expand All @@ -210,6 +225,21 @@
}
]
},
"BackgroundColor": {
"$id": "#/properties/Environment/properties/Observers/properties/BackgroundColor",
"type": "array",
"title": "Color",
"description": "The color of the background of the game",
"additionalItems": false,
"minItems": 3,
"maxItems": 3,
"items": {
"$id": "#/properties/Objects/items/properties/Observers/properties/BackgroundColor/item",
"type": "number",
"title": "Color value",
"description": "A float value for RGB"
}
},
"BackgroundTile": {
"$id": "#/properties/Environment/properties/Observers/properties/BackgroundTile",
"type": "string",
Expand Down Expand Up @@ -666,7 +696,7 @@
"type": "boolean",
"title": "Relative",
"description": "If the Offset of the collision detector should be relative to the direction that the object is facing."
},
},
"Offset": {
"$id": "#/properties/Actions/items/properties/Trigger/properties/Offset",
"type": "array",
Expand All @@ -676,7 +706,7 @@
"maxItems": 2,
"minItems": 2,
"items": {
"$id": "#/properties/Objects/items/properties/Observers/properties/Isometric/properties/Offset/item",
"$id": "#/properties/Objects/items/properties/Trigger/properties/Offset/item",
"title": "Offset Coordinate",
"description": "Coordinate for rendering offset of isometric tiles",
"type": "integer"
Expand Down
Binary file added resources/images/block_shapes/fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion resources/shaders/default/block/triangle-textured.frag
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct ObjectData{
layout(std140,binding=1)uniform EnvironmentData{
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down Expand Up @@ -96,7 +97,17 @@ void main()
outFragColor=texture(samplerArray,inFragTextureCoords)*inColor;
}

if(environmentData.globalObserverAvatarMode==3){
if(environmentData.globalObserverAvatarMode==4){
if(isInPlayerView()){

// outFragColor=vec4(mix(outFragColor.rgb,environmentData.globalObserverAvatarHighlightColor.rgb,0.7),1.);
outFragColor=vec4(
min(1.,outFragColor.x+environmentData.globalObserverAvatarHighlightColor.x),
min(1.,outFragColor.y+environmentData.globalObserverAvatarHighlightColor.y),
min(1.,outFragColor.z+environmentData.globalObserverAvatarHighlightColor.z),
outFragColor.w);
}
}else if(environmentData.globalObserverAvatarMode==3){
if(!isInPlayerView()){
outFragColor=vec4(0);
}
Expand Down
1 change: 1 addition & 0 deletions resources/shaders/default/block/triangle-textured.vert
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct ObjectData {
layout(std140, binding = 1) uniform EnvironmentData {
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
13 changes: 11 additions & 2 deletions resources/shaders/default/isometric/triangle-textured.frag
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct PlayerInfo{
vec4 playerObservableGrid;
};

struct ObjectData {
struct ObjectData{
mat4 modelMatrix;
vec4 color;
vec4 gridPosition;
Expand All @@ -30,6 +30,7 @@ struct ObjectData {
layout(std140,binding=1)uniform EnvironmentData{
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down Expand Up @@ -79,7 +80,15 @@ void main()
outFragColor=texture(samplerArray,inFragTextureCoords)*inColor;
}

if(inIsInView == 0){
if(inIsInView==1){
if(environmentData.globalObserverAvatarMode==4){
outFragColor=vec4(
min(1.,outFragColor.x+environmentData.globalObserverAvatarHighlightColor.x),
min(1.,outFragColor.y+environmentData.globalObserverAvatarHighlightColor.y),
min(1.,outFragColor.z+environmentData.globalObserverAvatarHighlightColor.z),
outFragColor.w);
}
}else{
if(environmentData.globalObserverAvatarMode==3){
outFragColor=vec4(0);
}else if(environmentData.globalObserverAvatarMode==2){
Expand Down
1 change: 1 addition & 0 deletions resources/shaders/default/isometric/triangle-textured.vert
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct ObjectData {
layout(std140, binding = 1) uniform EnvironmentData {
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
11 changes: 10 additions & 1 deletion resources/shaders/default/sprite/triangle-textured.frag
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct ObjectData{
layout(std140,binding=1)uniform EnvironmentData{
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down Expand Up @@ -97,7 +98,15 @@ void main()
outFragColor=texture(samplerArray,inFragTextureCoords)*inColor;
}

if(environmentData.globalObserverAvatarMode==3){
if(environmentData.globalObserverAvatarMode==4){
if(isInPlayerView()){
outFragColor=vec4(
min(1.,outFragColor.x+environmentData.globalObserverAvatarHighlightColor.x),
min(1.,outFragColor.y+environmentData.globalObserverAvatarHighlightColor.y),
min(1.,outFragColor.z+environmentData.globalObserverAvatarHighlightColor.z),
outFragColor.w);
}
}else if(environmentData.globalObserverAvatarMode==3){
if(!isInPlayerView()){
outFragColor=vec4(0);
}
Expand Down
1 change: 1 addition & 0 deletions resources/shaders/default/sprite/triangle-textured.vert
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct ObjectData {
layout(std140, binding = 1) uniform EnvironmentData {
mat4 projectionMatrix;
mat4 viewMatrix;
vec4 globalObserverAvatarHighlightColor;
vec2 gridDims;
int playerCount;
int playerId;
Expand Down
7 changes: 7 additions & 0 deletions src/Griddly/Core/GDY/GDYFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ BlockObserverConfig GDYFactory::parseNamedBlockObserverConfig(std::string observ
config.highlightPlayers = resolveObserverConfigValue<bool>("HighlightPlayers", observerConfigNode, playerCount_ > 1, !isGlobalObserver);
config.rotateAvatarImage = resolveObserverConfigValue<bool>("RotateAvatarImage", observerConfigNode, config.rotateAvatarImage, !isGlobalObserver);

auto backgroundColorNode = observerConfigNode["BackgroundColor"];
config.backgroundColor = parseColorNode(observerConfigNode["BackgroundColor"]);

if (objectNames_.size() == 0) {
return config;
}
Expand Down Expand Up @@ -473,6 +476,8 @@ void GDYFactory::parseNamedObserverShaderConfig(VulkanObserverConfig& config, YA
return;
}

config.globalObserverAvatarHighlightColor = parseColorNode(shaderConfigNode["ObserverAvatarHighlightColor"]);

auto globalObserverAvatarMode = shaderConfigNode["ObserverAvatarMode"];
if (globalObserverAvatarMode.IsDefined()) {
auto avatarMode = globalObserverAvatarMode.as<std::string>();
Expand All @@ -482,6 +487,8 @@ void GDYFactory::parseNamedObserverShaderConfig(VulkanObserverConfig& config, YA
config.globalObserverAvatarMode = GlobalObserverAvatarMode::DARKEN_INVISIBLE;
} else if (avatarMode == "REMOVE") {
config.globalObserverAvatarMode = GlobalObserverAvatarMode::REMOVE_INVISIBLE;
} else if (avatarMode == "HIGHLIGHT") {
config.globalObserverAvatarMode = GlobalObserverAvatarMode::HIGHLIGHT_VISIBLE;
} else {
std::string error = fmt::format("No avatar mode called {0} exists.", avatarMode);
throwParserError(error);
Expand Down
16 changes: 16 additions & 0 deletions src/Griddly/Core/GDY/YAMLUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,20 @@ inline YAML::iterator validateCommandPairNode(YAML::Node& commandPairNodeList) {
return commandPairNodeList.begin();
}

inline glm::vec3 parseColorNode(YAML::Node colorNode) {
if (colorNode.IsDefined()) {
if (!colorNode.IsSequence() || colorNode.size() != 3) {
auto error = fmt::format("Color node misconfigured, must contain 3 values but contains {0}.", colorNode.size());
throwParserError(error);
} else {
return glm::vec3{
colorNode[0].as<float>(0),
colorNode[1].as<float>(0),
colorNode[2].as<float>(0)};
}
}

return glm::vec3{};
}

} // namespace griddly
11 changes: 11 additions & 0 deletions src/Griddly/Core/Observers/BlockObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const std::map<std::string, SpriteDefinition> BlockObserver::blockSpriteDefiniti
{"square", {{"block_shapes/square.png"}}},
{"pentagon", {{"block_shapes/pentagon.png"}}},
{"hexagon", {{"block_shapes/hexagon.png"}}},
{"fill", {{"block_shapes/fill.png"}}},
};

BlockObserver::BlockObserver(std::shared_ptr<Grid> grid, BlockObserverConfig& config)
Expand All @@ -32,6 +33,16 @@ void BlockObserver::updateObjectSSBOData(PartialObservableGrid& observableGrid,
const auto& objects = grid_->getObjects();
const auto& objectIds = grid_->getObjectIds();

vk::ObjectDataSSBO backgroundTiling;
backgroundTiling.modelMatrix = glm::translate(backgroundTiling.modelMatrix, glm::vec3(gridWidth_ / 2.0 - config_.gridXOffset, gridHeight_ / 2.0 - config_.gridYOffset, 0.0));
backgroundTiling.modelMatrix = glm::scale(backgroundTiling.modelMatrix, glm::vec3(gridWidth_, gridHeight_, 1.0));
backgroundTiling.gridPosition = {0, 0, -10, 0};
backgroundTiling.color = glm::vec4(config_.backgroundColor, 1.0);
backgroundTiling.textureMultiply = {gridWidth_, gridHeight_};
backgroundTiling.textureIndex = device_->getSpriteArrayLayer("fill");
backgroundTiling.objectTypeId = 1000;
frameSSBOData_.objectSSBOData.push_back({backgroundTiling});

for (auto& object : objects) {
auto location = object->getLocation();

Expand Down
1 change: 1 addition & 0 deletions src/Griddly/Core/Observers/BlockObserver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct BlockDefinition {

struct BlockObserverConfig : public SpriteObserverConfig {
std::map<std::string, BlockDefinition> blockDefinitions;
glm::vec3 backgroundColor{};
};

class BlockObserver : public SpriteObserver {
Expand Down
Loading

0 comments on commit 11f6432

Please sign in to comment.