Moving some assets around

This commit is contained in:
2023-06-20 10:54:15 -07:00
parent d679b06b9f
commit ac797c8abb
49 changed files with 215 additions and 98 deletions

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
include("${CMAKE_CURRENT_LIST_DIR}/fonts/CMakeLists.txt")
include("${CMAKE_CURRENT_LIST_DIR}/prefabs/CMakeLists.txt")
include("${CMAKE_CURRENT_LIST_DIR}/scenes/CMakeLists.txt")
include("${CMAKE_CURRENT_LIST_DIR}/textures/CMakeLists.txt")

View File

@ -0,0 +1,11 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
tool_truetype(font_main
REGULAR=${CMAKE_CURRENT_LIST_DIR}/Ysabeau-Medium.ttf
BOLD=${CMAKE_CURRENT_LIST_DIR}/Ysabeau-SemiBold.ttf
ITALICS=${CMAKE_CURRENT_LIST_DIR}/Ysabeau-MediumItalic.ttf
BOLD_ITALICS=${CMAKE_CURRENT_LIST_DIR}/Ysabeau-SemiBoldItalic.ttf
)

View File

@ -0,0 +1,7 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
tool_prefab(${CMAKE_CURRENT_LIST_DIR}/EthPrefab.xml)
tool_prefab(${CMAKE_CURRENT_LIST_DIR}/VNTextbox.xml)

View File

@ -1,49 +1,43 @@
<prefab name="EthPrefab" type="">
<asset type="texture" name="texture_eth_faces_day" ref="faceTexture" />
<asset type="texture" name="texture_eth_poses_day" ref="bodyTexture" />
<asset type="texture" name="texture_eth_face_day_happy" ref="faceDayHappy" />
<asset type="texture" name="texture_eth_face_day_anger" ref="faceDayAnger" />
<asset type="texture" name="texture_eth_pose_day_front" ref="poseDayFront" />
<asset type="texture" name="texture_eth_pose_day_back" ref="poseDayBack" />
<item>
<MeshRenderer />
<QuadMeshHost />
<SimpleBillboardedMaterial texture="faceTexture" ref="faceMaterial" />
<TiledSprite tile="0" ref="faceSprite" sizeType="TILED_SPRITE_SIZE_TYPE_HEIGHT_RATIO" size="0.5" />
<SimpleTexturedMaterial texture="faceDayHappy" ref="faceMaterial" />
<TiledSprite ref="faceSprite" tile="0" size="0.5" sizeType="TILED_SPRITE_SIZE_TYPE_HEIGHT_RATIO" />
</item>
<item>
<MeshRenderer />
<QuadMeshHost />
<SimpleBillboardedMaterial texture="bodyTexture" ref="bodyMaterial" />
<TiledSprite tile="0" ref="bodySprite" sizeType="TILED_SPRITE_SIZE_TYPE_HEIGHT_RATIO" size="0.5" />
<QuadMeshHost ref="bodyMesh" />
<SimpleTexturedMaterial texture="poseDayFront" ref="bodyMaterial" />
<TiledSprite ref="bodySprite" tile="0" size="0.5" sizeType="TILED_SPRITE_SIZE_TYPE_HEIGHT_RATIO" />
</item>
<code type="properties">
TilesetGrid gridFace;
TilesetGrid gridBody;
StateProperty&lt;float_t&gt; alpha;
StateProperty&lt;int32_t&gt; faceTile;
</code>
<code type="init">
alpha = 0.0f;
this->gridFace = TilesetGrid(
1, 9,
faceTexture->texture.getWidth(), faceTexture->texture.getHeight(),
0, 0,
0, 0
);
gridFace = TilesetGrid(faceDayHappy->texture, 1, 1);
faceSprite->tileset = &amp;gridFace;
this->gridBody = TilesetGrid(
1, 5,
bodyTexture->texture.getWidth(), bodyTexture->texture.getHeight(),
0, 0,
0, 0
);
gridBody = TilesetGrid(poseDayBack->texture, 1, 1);
bodySprite->tileset = &amp;gridBody;
useEffect([&amp;]{
this->faceMaterial->color.a = alpha;
this->bodyMaterial->color.a = alpha;
}, alpha);
faceMaterial->texture = (
faceTile == 0 ? &amp;faceDayHappy->texture :
faceTile == 1 ? &amp;faceDayAnger->texture :
nullptr
);
}, faceTile)();
</code>
</prefab>

View File

@ -0,0 +1,7 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
tool_scene(${CMAKE_CURRENT_LIST_DIR}/SceneBase.xml)
tool_vnscene(${CMAKE_CURRENT_LIST_DIR}/Scene1Prologue0.xml)

View File

@ -4,20 +4,19 @@
<string lang="en"><font style="italics">There is a bucket.</font></string>
</text>
<set property="eth->color"
<set property="eth->faceSprite->tile" to="1" type="int32_t" />
<set property="eth->faceTile" to="1" type="int32_t" />
<text>
<string lang="en">It sways above your head like the mouth of a god. You are on Angelwood's best stage, and they are cheering for you, calling you their Queen, their Prom Queen.</string>
</text>
<set property="eth->faceSprite->tile" to="0" type="int32_t" />
<!-- <set property="eth->faceSprite->tile" to="0" type="int32_t" /> -->
<text>
<string lang="en">And you are dead soon.</string>
</text>
<set property="eth->bodySprite->tile" to="3" type="int32_t" />
<!-- <set property="eth->bodySprite->tile" to="3" type="int32_t" /> -->
<text>
<string lang="en">It's Prom Day. The metal bucket is swaying. Over you. Drenching your white pristine dress in guts and gore red. They aren't cheering anymore. They're gasping. But not screaming: oh, no, not in respectable Angelwood.</string>

View File

@ -6,9 +6,8 @@
<item ref="eth" prefab="prefabs/EthPrefab" />
<item lookAt="0, 0, 5, 0, 0, 0" >
<!-- <item lookAt="5, 5, 5, 0, 0, 0" > -->
<!-- <item lookAt="3, 3, 3, 0, 0, 0" > -->
<Camera ref="camera" type="CAMERA_TYPE_ORTHONOGRAPHIC" />
<!-- <Camera ref="camera" /> -->
<CameraTexture ref="camTexture" />
</item>

View File

@ -0,0 +1,12 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
set(LIMINIAL_CHARACTER_SCALE 1.0)
include("${CMAKE_CURRENT_LIST_DIR}/eth/CMakeLists.txt")
tool_texture(texture_border
FILE=${CMAKE_CURRENT_LIST_DIR}/texture_test.png
)

View File

@ -0,0 +1,7 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
include("${CMAKE_CURRENT_LIST_DIR}/faces/CMakeLists.txt")
include("${CMAKE_CURRENT_LIST_DIR}/poses/CMakeLists.txt")

View File

@ -0,0 +1,50 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
tool_texture(texture_eth_face_day_anger
FILE="${CMAKE_CURRENT_LIST_DIR}/anger.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_face_day_confused
FILE="${CMAKE_CURRENT_LIST_DIR}/confused.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_face_day_eyeroll
FILE="${CMAKE_CURRENT_LIST_DIR}/eyeroll.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_face_day_fear
FILE="${CMAKE_CURRENT_LIST_DIR}/fear.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_face_day_happy
FILE="${CMAKE_CURRENT_LIST_DIR}/happy.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_face_day_haughty
FILE="${CMAKE_CURRENT_LIST_DIR}/haughty.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_face_day_neutral
FILE="${CMAKE_CURRENT_LIST_DIR}/neutral.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_face_day_sad
FILE="${CMAKE_CURRENT_LIST_DIR}/sad.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_face_day_surprised
FILE="${CMAKE_CURRENT_LIST_DIR}/surprised.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 MiB

View File

@ -0,0 +1,13 @@
# Copyright (c) 2023 Dominic Masters
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
tool_texture(texture_eth_pose_day_front
FILE="${CMAKE_CURRENT_LIST_DIR}/day_front.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_pose_day_back
FILE="${CMAKE_CURRENT_LIST_DIR}/day_back.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

View File

@ -1,4 +0,0 @@
<prefab name="FPSLabel" type="ui/debug">
<!-- <UILabel ref="label" text="Hello World" /> -->
<!-- <FPSLabelComponent label="label" /> -->
</prefab>

View File

@ -43,7 +43,4 @@ target_compile_definitions(${DAWN_TARGET_NAME}
PUBLIC
${DAWN_SHARED_DEFINITIONS}
DAWN_DEBUG_BUILD=${DAWN_DEBUG_BUILD}
)
# Common Prefabs
tool_prefab("prefabs/ui/debug/FPSLabel.xml")
)

View File

@ -18,6 +18,33 @@ TilesetGrid::TilesetGrid() {
}
TilesetGrid::TilesetGrid(
Texture *texture,
int32_t columns,
int32_t rows
) : TilesetGrid(
columns, rows,
texture->getWidth(), texture->getHeight(),
0, 0,
0, 0
) {
}
TilesetGrid::TilesetGrid(
Texture &texture,
int32_t columns,
int32_t rows
) : TilesetGrid(
columns, rows,
texture.getWidth(), texture.getHeight(),
0, 0,
0, 0
) {
}
TilesetGrid::TilesetGrid(
int32_t columns,
int32_t rows,

View File

@ -6,6 +6,7 @@
#pragma once
#include "dawnlibs.hpp"
#include "assert/assert.hpp"
#include "display/Texture.hpp"
namespace Dawn {
struct Tile {
@ -53,6 +54,24 @@ namespace Dawn {
* Constructs a new Tileset Grid.
*/
TilesetGrid();
/**
* Constructs a new Tileset Grid from a texture.
*
* @param texture Texture to use.
* @param columns Columns in the grid.
* @param rows Rows in the grid.
*/
TilesetGrid(Texture *texture, int32_t columns, int32_t rows);
/**
* Constructs a new Tileset Grid from a texture.
*
* @param texture Texture to use.
* @param columns Columns in the grid.
* @param rows Rows in the grid.
*/
TilesetGrid(Texture &texture, int32_t columns, int32_t rows);
/**
* Constructs a new Tileset Grid.

View File

@ -17,39 +17,5 @@ add_subdirectory(game)
add_subdirectory(save)
# Assets
set(LIMINAL_ASSETS_DIR ${DAWN_ASSETS_DIR}/games/liminal)
set(LIMINIAL_CHARACTER_SCALE 0.2)
tool_texture(texture_eth_faces_day
FILE="${LIMINAL_ASSETS_DIR}/textures/eth/faces_day.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_faces_night
FILE="${LIMINAL_ASSETS_DIR}/textures/eth/faces_night.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_poses_day
FILE="${LIMINAL_ASSETS_DIR}/textures/eth/poses_day.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_eth_poses_night
FILE="${LIMINAL_ASSETS_DIR}/textures/eth/test.png"
SCALE=${LIMINIAL_CHARACTER_SCALE}
)
tool_texture(texture_border
FILE=${LIMINAL_ASSETS_DIR}/textures/texture_test.png
)
tool_truetype(font_main
REGULAR=${LIMINAL_ASSETS_DIR}/fonts/Ysabeau-Medium.ttf
BOLD=${LIMINAL_ASSETS_DIR}/fonts/Ysabeau-SemiBold.ttf
ITALICS=${LIMINAL_ASSETS_DIR}/fonts/Ysabeau-MediumItalic.ttf
BOLD_ITALICS=${LIMINAL_ASSETS_DIR}/fonts/Ysabeau-SemiBoldItalic.ttf
)
tool_scene(${LIMINAL_ASSETS_DIR}/scenes/SceneBase.xml)
tool_vnscene(${LIMINAL_ASSETS_DIR}/scenes/Scene1Prologue0.xml)
tool_prefab(${LIMINAL_ASSETS_DIR}/prefabs/EthPrefab.xml)
tool_prefab(${LIMINAL_ASSETS_DIR}/prefabs/VNTextbox.xml)
set(LIMINAL_ASSETS_DIR )
include("${DAWN_ASSETS_SOURCE_DIR}/games/liminal/CMakeLists.txt")

View File

@ -37,8 +37,8 @@ std::vector<struct ShaderPassItem> SimpleTexturedMaterial::getRenderPasses(IRend
onlyPass.parameterBuffers[shader->bufferRenderPipeline] = &context.renderPipeline->shaderBuffer;
onlyPass.renderFlags = (
RENDER_MANAGER_RENDER_FLAG_BLEND |
RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST
RENDER_MANAGER_RENDER_FLAG_BLEND
// RENDER_MANAGER_RENDER_FLAG_DEPTH_TEST
);
if(this->texture != nullptr) {

View File

@ -201,10 +201,17 @@ void Xml::load(Xml *xml, std::string data, size_t *j) {
buffer += '\'';
} else if(sc == "quot") {
buffer += '"';
} else if(sc == "nbsp") {
buffer += ' ';
} else {
// Unknown special char?
std::cout << "Unknown Special character: " << sc << std::endl;
assertUnreachable();
// Try parse as integer
if(sc.size() > 1 && sc[0] == '#') {
int code = std::stoi(sc.substr(1));
buffer += (char)code;
} else {
std::cout << "Unknown Special character: " << sc << std::endl;
assertUnreachable();
}
}
} else {
buffer += c;

View File

@ -48,7 +48,7 @@ function(tool_prefab in)
STRING(REGEX REPLACE "[\.|\\|\/]" "-" prefab_name ${in})
add_custom_target(prefab_${prefab_name}
COMMAND prefabtool --input="${DAWN_ASSETS_SOURCE_DIR}/${in}" --output="${DAWN_GENERATED_DIR}/generatedprefabs" --sources="${DAWN_SOURCES_DIR}"
COMMAND prefabtool --input="${in}" --output="${DAWN_GENERATED_DIR}/generatedprefabs" --sources="${DAWN_SOURCES_DIR}"
COMMENT "Generating prefab from ${in}"
DEPENDS ${DEPS}
)

View File

@ -49,7 +49,7 @@ function(tool_scene in)
STRING(REGEX REPLACE "[\.|\\|\/]" "-" scene_name ${in})
add_custom_target(scene_${scene_name}
COMMAND scenetool --input="${DAWN_ASSETS_SOURCE_DIR}/${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes" --sources="${DAWN_SOURCES_DIR}"
COMMAND scenetool --input="${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes" --sources="${DAWN_SOURCES_DIR}"
COMMENT "Generating scene from ${in}"
DEPENDS ${DEPS}
)

View File

@ -68,7 +68,7 @@ function(tool_texture target)
add_custom_target(${target}
COMMAND texturetool
--input="${DAWN_ASSETS_SOURCE_DIR}/${FILE}"
--input="${FILE}"
--output="${DAWN_ASSETS_BUILD_DIR}/${target}"
--wrapX="${WRAP_X}"
--wrapY="${WRAP_Y}"

View File

@ -53,19 +53,6 @@ function(tool_truetype target)
set(DEPS truetypetool)
endif()
if(DEFINED REGULAR)
set(REGULAR "${DAWN_ASSETS_SOURCE_DIR}/${REGULAR}")
endif()
if(DEFINED BOLD)
set(BOLD "${DAWN_ASSETS_SOURCE_DIR}/${BOLD}")
endif()
if(DEFINED ITALICS)
set(ITALICS "${DAWN_ASSETS_SOURCE_DIR}/${ITALICS}")
endif()
if(DEFINED BOLD_ITALICS)
set(BOLD_ITALICS "${DAWN_ASSETS_SOURCE_DIR}/${BOLD_ITALICS}")
endif()
add_custom_target(${target}
COMMAND truetypetool
--output="${DAWN_ASSETS_BUILD_DIR}/${target}.truetype"

View File

@ -10,6 +10,7 @@ using namespace Dawn;
void SceneAssetGenerator::generate(
std::map<std::string, std::string> &assetMap,
int32_t &assetNumber,
std::vector<std::string> *publicProperties,
std::vector<std::string> *initBody,
std::vector<std::string> *assetsBody,
struct SceneAsset *asset,
@ -17,6 +18,7 @@ void SceneAssetGenerator::generate(
) {
std::string assetType = "";
bool_t componentInit = true;
if(asset->ref.empty()) {
asset->usageName = "asset" + std::to_string(assetNumber++);
} else {
@ -40,6 +42,12 @@ void SceneAssetGenerator::generate(
assertUnreachable();
}
line(initBody, "auto " + asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", "");
if(!asset->ref.empty()) {
line(publicProperties, assetType + " *" + asset->usageName + " = nullptr;", "");
line(initBody, asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", "");
} else {
line(initBody, "auto " + asset->usageName + " = man->get<" + assetType + ">(\"" + asset->fileName + "\");", "");
}
line(assetsBody, "assets.push_back(man->get<" + assetType + ">(\"" + asset->fileName + "\"));", "");
}

View File

@ -13,6 +13,7 @@ namespace Dawn {
static void generate(
std::map<std::string, std::string> &assetMap,
int32_t &assetNumber,
std::vector<std::string> *publicProperties,
std::vector<std::string> *initBody,
std::vector<std::string> *assetsBody,
struct SceneAsset *asset,

View File

@ -149,6 +149,7 @@ void SceneItemGenerator::generate(
SceneAssetGenerator::generate(
assetMap,
assetNumber,
publicProperties,
initBody,
assetBody,
&(*itAssets),

View File

@ -52,7 +52,7 @@ function(tool_vnscene in)
STRING(REGEX REPLACE "[\.|\\|\/]" "-" scene_name ${in})
add_custom_target(scene_${scene_name}
COMMAND vnscenetool --input="${DAWN_ASSETS_SOURCE_DIR}/${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes"
COMMAND vnscenetool --input="${in}" --output="${DAWN_GENERATED_DIR}/generatedscenes"
COMMENT "Generating vnscene from ${in}"
DEPENDS ${DEPS}
)