Fixed a few small things.

This commit is contained in:
2023-06-20 09:29:16 -07:00
parent 9574e9a3e9
commit d679b06b9f
13 changed files with 118 additions and 23 deletions

View File

@ -2,38 +2,48 @@
<asset type="texture" name="texture_eth_faces_day" ref="faceTexture" />
<asset type="texture" name="texture_eth_poses_day" ref="bodyTexture" />
<item>
<MeshRenderer />
<QuadMeshHost />
<SimpleBillboardedMaterial texture="faceTexture" />
<SimpleBillboardedMaterial texture="faceTexture" ref="faceMaterial" />
<TiledSprite tile="0" ref="faceSprite" sizeType="TILED_SPRITE_SIZE_TYPE_HEIGHT_RATIO" size="0.5" />
</item>
<!-- <item>
<item>
<MeshRenderer />
<QuadMeshHost />
<SimpleBillboardedMaterial texture="bodyTexture" />
<SimpleBillboardedMaterial texture="bodyTexture" ref="bodyMaterial" />
<TiledSprite tile="0" ref="bodySprite" sizeType="TILED_SPRITE_SIZE_TYPE_HEIGHT_RATIO" size="0.5" />
</item> -->
</item>
<code type="properties">
TilesetGrid gridFace;
TilesetGrid gridBody;
StateProperty&lt;float_t&gt; alpha;
</code>
<code type="init">
alpha = 0.0f;
this->gridFace = TilesetGrid(
1, 9,
faceTexture->texture.getWidth(), faceTexture->texture.getHeight(),
0, 0,
0, 0
);
faceSprite->tileset = &gridFace;
faceSprite->tileset = &amp;gridFace;
this->gridBody = TilesetGrid(
1, 9,
1, 5,
bodyTexture->texture.getWidth(), bodyTexture->texture.getHeight(),
0, 0,
0, 0
);
//bodySprite->tileset = &gridBody;
bodySprite->tileset = &amp;gridBody;
useEffect([&amp;]{
this->faceMaterial->color.a = alpha;
this->bodyMaterial->color.a = alpha;
}, alpha);
</code>
</prefab>

View File

@ -4,14 +4,21 @@
<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" />
<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" />
<text>
<string lang="en">And you are dead soon.</string>
</text>
<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>
</text>

View File

@ -5,10 +5,10 @@
<item ref="eth" prefab="prefabs/EthPrefab" />
<!-- <item lookAt="0, 0, 5, 0, 0, 0" > -->
<item lookAt="5, 5, 5, 0, 0, 0" >
<!-- <Camera ref="camera" type="CAMERA_TYPE_ORTHONOGRAPHIC" /> -->
<Camera ref="camera" />
<item lookAt="0, 0, 5, 0, 0, 0" >
<!-- <item lookAt="5, 5, 5, 0, 0, 0" > -->
<Camera ref="camera" type="CAMERA_TYPE_ORTHONOGRAPHIC" />
<!-- <Camera ref="camera" /> -->
<CameraTexture ref="camTexture" />
</item>
@ -33,7 +33,7 @@
</item>
<code type="init">
useEvent([&]{
useEvent([&amp;]{
assertNotNull(camTexture);
assertNotNull(image);
camTexture->renderTarget.setSize(image->getWidth(), image->getHeight());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 MiB

After

Width:  |  Height:  |  Size: 58 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

@ -10,18 +10,18 @@ namespace Dawn {
template<typename T>
class VNSetEvent : public VNAnimateEvent<T> {
public:
T *modifies = nullptr;
StateProperty<T> *modifies = nullptr;
protected:
void onStart() override {
assertNotNull(this->modifies);
this->from = *modifies;
this->from = modifies->getValue();
VNAnimateEvent<T>::onStart();
}
void setValue(T value) override {
*modifies = value;
modifies->setValue(value);
}
};
}

View File

@ -110,6 +110,26 @@ namespace Dawn {
return this->_realValue;
}
/**
* Provides an alternate way to set the value, e.g. if using the equals
* operator is not possible.
*
* @param val Value to set on this property.
*/
void setValue(V val) {
this->setInternal(val);
}
/**
* Provides an alternate way to get the value, e.g. if using the equals
* operator is not possible.
*
* @return The value of this property.
*/
V getValue() {
return this->_realValue;
}
/**
* Destructor for StateProperty.
*/

View File

@ -19,14 +19,22 @@ 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}
)

View File

@ -46,6 +46,14 @@ void Texture::setSize(
glDeleteTextures(1, &this->id);
this->id = -1;
}
#if DAWN_DEBUG_BUILD
int32_t maxSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize);
assertTrue(width > 0 && width <= maxSize);
assertTrue(height > 0 && height <= maxSize);
#endif
this->width = width;
this->height = height;

View File

@ -38,8 +38,7 @@ std::vector<struct ShaderPassItem> SimpleBillboardedMaterial::getRenderPasses(IR
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
);
if(this->texture != nullptr) {

View File

@ -174,7 +174,41 @@ void Xml::load(Xml *xml, std::string data, size_t *j) {
buffer += bufferWhitespaces;
valueIsInWhitespace = false;
}
buffer += c;
if(c == '&') {
// Handle special characters. First read ahead to nearest semicolon OR
// nearest closing tag.
std::string sc;
while(c = data[i++]) {
xml->innerXml += c;
if(c == ';') break;
if(c == '<') assertUnreachable();//Invalid XML
sc += c;
}
if(valueIsInWhitespace) {
buffer += bufferWhitespaces;
valueIsInWhitespace = false;
}
if(sc == "lt") {
buffer += '<';
} else if(sc == "gt") {
buffer += '>';
} else if(sc == "amp") {
buffer += '&';
} else if(sc == "apos") {
buffer += '\'';
} else if(sc == "quot") {
buffer += '"';
} else {
// Unknown special char?
std::cout << "Unknown Special character: " << sc << std::endl;
assertUnreachable();
}
} else {
buffer += c;
}
}
break;

View File

@ -45,6 +45,7 @@ function(tool_texture target)
set(FILTER_MAG "")
set(WRAP_X "")
set(WRAP_Y "")
set(SCALE "")
# Parse Args
foreach(_PAIR IN LISTS ARGN)
@ -73,6 +74,7 @@ function(tool_texture target)
--wrapY="${WRAP_Y}"
--filterMin="${FILTER_MIN}"
--filterMag="${FILTER_MIN}"
--scale="${SCALE}"
COMMENT "Generating texture ${target} from ${FILE}"
DEPENDS ${DEPS}
)

View File

@ -16,7 +16,8 @@ std::map<std::string, std::string> TextureTool::getOptionalFlags() {
{ "wrapX", "clamp" },
{ "wrapY", "clamp" },
{ "filterMin", "linear" },
{ "filterMax", "linear" }
{ "filterMax", "linear" },
{ "scale", "" }
};
}
@ -40,13 +41,19 @@ int32_t TextureTool::start() {
}
in.close();
// Convert to floating points
// Buffer to output
size_t len = STBI_rgb_alpha * w * h;
uint8_t *dataImage = (uint8_t*)malloc(sizeof(uint8_t) * len);
for(size_t i = 0; i < len; i++) {
auto dataIn = imageRaw[i];
dataImage[i] = dataIn;
if(!flags["scale"].empty()) {
float_t scale = std::stof(flags["scale"]);
stbir_resize_uint8(imageRaw, w, h, 0, dataImage, w * scale, h * scale, 0, STBI_rgb_alpha);
w = w * scale;
h = h * scale;
} else {
memcpy(dataImage, imageRaw, len);
}
stbi_image_free(imageRaw);
std::function<int32_t(std::string)> wrapFromString = [&](std::string wr) {