minor adjustments

This commit is contained in:
h4570
2023-05-28 22:55:42 +02:00
parent 20d2291a88
commit cab934763f
10 changed files with 299 additions and 271 deletions
@@ -31,8 +31,9 @@ class RendererCore2D {
void render(const Sprite& sprite,
const RendererCoreTextureBuffers& texBuffers, Texture* texture);
void setTextureMappingType(const PipelineTextureMappingType textureMappingType);
void setTextureMappingType(
const PipelineTextureMappingType textureMappingType);
private:
void setPrim();
void setLod();
@@ -84,10 +84,12 @@ void RendererCore2D::render(const Sprite& sprite,
else if (sizeY > sizeX)
texS = texMax / (sizeY / sizeX);
rect->t0.s = sprite.flipHorizontal ? (texS+sprite.offset.x) : sprite.offset.x;
rect->t0.t = sprite.flipVertical ? (texT+sprite.offset.y) : sprite.offset.y;
rect->t1.s = sprite.flipHorizontal ? sprite.offset.x : (texS+sprite.offset.x);
rect->t1.t = sprite.flipVertical ? sprite.offset.y : (texT+sprite.offset.y);
rect->t0.s =
sprite.flipHorizontal ? (texS + sprite.offset.x) : sprite.offset.x;
rect->t0.t = sprite.flipVertical ? (texT + sprite.offset.y) : sprite.offset.y;
rect->t1.s =
sprite.flipHorizontal ? sprite.offset.x : (texS + sprite.offset.x);
rect->t1.t = sprite.flipVertical ? sprite.offset.y : (texT + sprite.offset.y);
rect->color.r = sprite.color.r;
rect->color.g = sprite.color.g;
@@ -131,7 +133,8 @@ void RendererCore2D::render(const Sprite& sprite,
context = !context;
}
void RendererCore2D::setTextureMappingType(const PipelineTextureMappingType textureMappingType){
void RendererCore2D::setTextureMappingType(
const PipelineTextureMappingType textureMappingType) {
lod.mag_filter = textureMappingType;
lod.min_filter = textureMappingType;
}
@@ -18,7 +18,7 @@ Sprite::Sprite() {
flipVertical = false;
size.set(32.0F, 32.0F);
position.set(100.0F, 100.0F);
offset.set(0.0F,0.0F);
offset.set(0.0F, 0.0F);
scale = 1.0F;
mode = MODE_REPEAT;
setDefaultColor();