Sprites can now be rendered with the texture ratio in mind
This commit is contained in:
+1
-1
Submodule assets updated: 3af64d8b1f...85d96f6f3d
@@ -49,11 +49,22 @@ struct SpriteJob : RenderJob
|
||||
FillColor = fillColor;
|
||||
FillPercentage = fillPercentage;
|
||||
|
||||
glm::vec3 scale = Transform::AbsoluteScale(world, cSprite.EntityID);
|
||||
|
||||
if((bool)cSprite["KeepRatioX"] == true) {
|
||||
ScaleX = Transform::AbsoluteScale(world, cSprite.EntityID).x;
|
||||
ScaleX = scale.x;
|
||||
}
|
||||
if ((bool)cSprite["KeepRatioZ"] == true) {
|
||||
ScaleY = Transform::AbsoluteScale(world, cSprite.EntityID).y;
|
||||
if ((bool)cSprite["KeepRatioY"] == true) {
|
||||
ScaleY = scale.y;
|
||||
}
|
||||
if((bool)cSprite["KeepRatio"] == true) {
|
||||
if(scale.y >= scale.x) {
|
||||
ScaleY = (scale.x)/(scale.y);
|
||||
ScaleX = 1;
|
||||
} else {
|
||||
ScaleY = 1;
|
||||
ScaleX = (scale.x)/(scale.y);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
<DepthSort>true</DepthSort>
|
||||
<KeepRatioX>false</KeepRatioX>
|
||||
<KeepRatioY>false</KeepRatioY>
|
||||
<KeepRatio>false</KeepRatio>
|
||||
<BlurBackground>false</BlurBackground>
|
||||
</Sprite>
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
<xs:element name="KeepRatioY" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Wether the sprite should repeat in y instead of stretch when scaled.</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="KeepRatio" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Keep a 1:1 ratio between X and Y.</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="BlurBackground" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>Wether the background should be blurred begind this sprite.</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
|
||||
@@ -311,8 +311,8 @@ void DrawFinalPass::Draw(RenderScene& scene, BlurHUD* blurHUDPass)
|
||||
GLERROR("TransparentObjects");
|
||||
//state->BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
stateSprite->Enable(GL_DEPTH_TEST);
|
||||
stateSprite->AlphaFunc(GL_GEQUAL, 0.05f);
|
||||
stateSprite->Enable(GL_ALPHA_TEST);
|
||||
//stateSprite->AlphaFunc(GL_GEQUAL, 0.05f);
|
||||
//stateSprite->Enable(GL_ALPHA_TEST);
|
||||
DrawSprites(scene.Jobs.SpriteJob, scene);
|
||||
GLERROR("SpriteJobs");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user