Some fixes for sprites

This commit is contained in:
Tleety
2016-03-10 15:21:11 +01:00
parent 79d0ef4529
commit 4322a5d8da
6 changed files with 124 additions and 81 deletions
+12 -2
View File
@@ -21,14 +21,23 @@ struct SpriteJob : RenderJob
SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted, bool isIndicator) SpriteJob(ComponentWrapper cSprite, Camera* camera, glm::mat4 matrix, World* world, glm::vec4 fillColor, float fillPercentage, bool depthSorted, bool isIndicator)
: RenderJob() : RenderJob()
{ {
Model = ResourceManager::Load<::Model>("Models/Core/UnitQuad.mesh"); Model = ResourceManager::Load<::Model>((std::string)cSprite["Model"]);
::RawModel::MaterialProperties matProp = Model->MaterialGroups().front(); ::RawModel::MaterialProperties matProp = Model->MaterialGroups().front();
TextureID = 0; TextureID = 0;
DiffuseTexture = CommonFunctions::TryLoadResource<TextureSprite, true>(cSprite["DiffuseTexture"]); DiffuseTexture = CommonFunctions::TryLoadResource<TextureSprite, true>(cSprite["DiffuseTexture"]);
IncandescenceTexture = CommonFunctions::TryLoadResource<TextureSprite, true>(cSprite["GlowMap"]); IncandescenceTexture = CommonFunctions::TryLoadResource<TextureSprite, true>(cSprite["GlowMap"]);
if ((bool)cSprite["Linear"]) {
glBindTexture(GL_TEXTURE_2D, DiffuseTexture->m_Texture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
} else {
glBindTexture(GL_TEXTURE_2D, DiffuseTexture->m_Texture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
StartIndex = matProp.material->StartIndex; StartIndex = matProp.material->StartIndex;
EndIndex = matProp.material->EndIndex; EndIndex = matProp.material->EndIndex;
Matrix = matrix; Matrix = matrix;
@@ -89,6 +98,7 @@ struct SpriteJob : RenderJob
bool BlurBackground = false; bool BlurBackground = false;
float ScaleX = 1; float ScaleX = 1;
float ScaleY = 1; float ScaleY = 1;
bool Linear = false;
glm::vec4 FillColor = glm::vec4(0); glm::vec4 FillColor = glm::vec4(0);
float FillPercentage = 0.0; float FillPercentage = 0.0;
+2
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Sprite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Sprite.xsd"> <Sprite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Sprite.xsd">
<Model>Models/Core/UnitQuad.mesh</Model>
<DiffuseTexture></DiffuseTexture> <DiffuseTexture></DiffuseTexture>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<Color R="1" G="1" B="1" A="1"/> <Color R="1" G="1" B="1" A="1"/>
@@ -8,5 +9,6 @@
<KeepRatioX>false</KeepRatioX> <KeepRatioX>false</KeepRatioX>
<KeepRatioY>false</KeepRatioY> <KeepRatioY>false</KeepRatioY>
<KeepRatio>false</KeepRatio> <KeepRatio>false</KeepRatio>
<Linear>false</Linear>
<BlurBackground>false</BlurBackground> <BlurBackground>false</BlurBackground>
</Sprite> </Sprite>
+9 -3
View File
@@ -9,14 +9,17 @@
</xs:annotation> </xs:annotation>
<xs:complexType> <xs:complexType>
<xs:all> <xs:all>
<xs:element name="Model" type="t:string" minOccurs="0">
<xs:annotation><xs:documentation>The model the sprite will use.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="DiffuseTexture" type="t:string" minOccurs="0"> <xs:element name="DiffuseTexture" type="t:string" minOccurs="0">
<xs:annotation><xs:documentation>Diffuse Texture file</xs:documentation></xs:annotation> <xs:annotation><xs:documentation>Diffuse Texture file.</xs:documentation></xs:annotation>
</xs:element> </xs:element>
<xs:element name="GlowMap" type="t:string" minOccurs="0"> <xs:element name="GlowMap" type="t:string" minOccurs="0">
<xs:annotation><xs:documentation>GlowMap file</xs:documentation></xs:annotation> <xs:annotation><xs:documentation>GlowMap file.</xs:documentation></xs:annotation>
</xs:element> </xs:element>
<xs:element name="Color" type="t:Color" minOccurs="0"> <xs:element name="Color" type="t:Color" minOccurs="0">
<xs:annotation><xs:documentation>Color tint</xs:documentation></xs:annotation> <xs:annotation><xs:documentation>Color tint.</xs:documentation></xs:annotation>
</xs:element> </xs:element>
<xs:element name="Visible" type="t:bool" minOccurs="0"> <xs:element name="Visible" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>Whether the model is visible or not</xs:documentation></xs:annotation> <xs:annotation><xs:documentation>Whether the model is visible or not</xs:documentation></xs:annotation>
@@ -33,6 +36,9 @@
<xs:element name="KeepRatio" type="t:bool" minOccurs="0"> <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:annotation><xs:documentation>Keep a 1:1 ratio between X and Y.</xs:documentation></xs:annotation>
</xs:element> </xs:element>
<xs:element name="Linear" type="t:bool" minOccurs="0">
<xs:annotation><xs:documentation>If it should use Linear or Nearest sampling method.</xs:documentation></xs:annotation>
</xs:element>
<xs:element name="BlurBackground" type="t:bool" minOccurs="0"> <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:annotation><xs:documentation>Wether the background should be blurred begind this sprite.</xs:documentation></xs:annotation>
</xs:element> </xs:element>
+94 -73
View File
@@ -8,7 +8,7 @@
</c:RaptorCopter> </c:RaptorCopter>
<c:Transform> <c:Transform>
<Position X="0" Y="-4" Z="0"/> <Position X="0" Y="-4" Z="0"/>
<Orientation X="0" Y="55.3495064" Z="0"/> <Orientation X="0" Y="58.3794823" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
@@ -34,13 +34,49 @@
</c:Transform> </c:Transform>
</Components> </Components>
<Children> <Children>
<Entity name="AssaultClassPick">
<Components>
<c:Button/>
<c:Sprite>
<DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Classes/Assault-01.png</DiffuseTexture>
</c:Sprite>
<c:InputCmdButton>
<Command>PickClass</Command>
<PressValue>1</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="-0.150000006" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity name="AssaultText">
<Components>
<c:Text>
<Content>Assault</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="0" G="1" R="0.784313738"/>
</c:Text>
<c:Transform>
<Position X="0" Y="0.800000012" Z="0"/>
<Scale X="0.310000002" Y="0.310000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="DefenderClassPick"> <Entity name="DefenderClassPick">
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Icons/Classes/Defender-01.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Classes/Defender-01.png</DiffuseTexture>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
<Command>PickClass</Command> <Command>PickClass</Command>
@@ -72,9 +108,10 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Icons/Classes/Sniper-01.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Icons/Classes/Sniper-01.png</DiffuseTexture>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
<Command>PickClass</Command> <Command>PickClass</Command>
@@ -102,40 +139,6 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="AssaultClassPick">
<Components>
<c:Button/>
<c:Sprite>
<DiffuseTexture>Textures/Icons/Classes/Assault-01.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort>
</c:Sprite>
<c:InputCmdButton>
<Command>PickClass</Command>
<PressValue>1</PressValue>
</c:InputCmdButton>
<c:Transform>
<Position X="-0.150000006" Y="-0.0500000007" Z="0"/>
<Scale X="0.0799999982" Y="0.0799999982" Z="1"/>
</c:Transform>
</Components>
<Children>
<Entity name="AssaultText">
<Components>
<c:Text>
<Content>Assault</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="0" G="1" R="0.784313738"/>
</c:Text>
<c:Transform>
<Position X="0" Y="0.800000012" Z="0"/>
<Scale X="0.310000002" Y="0.310000002" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ClassPickText"> <Entity name="ClassPickText">
<Components> <Components>
<c:Text> <c:Text>
@@ -154,9 +157,10 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="1" B="0" G="1" R="0.509803951"/> <Color A="1" B="0" G="1" R="0.509803951"/>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
@@ -232,9 +236,10 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="1" B="0" G="1" R="0.509803951"/> <Color A="1" B="0" G="1" R="0.509803951"/>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
@@ -266,10 +271,11 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture> <Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap> <GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="1" B="0" G="0.294117659" R="0.980392158"/> <Color A="1" B="0" G="0.294117659" R="0.980392158"/>
<Linear>true</Linear>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
<Command>PickTeam</Command> <Command>PickTeam</Command>
@@ -300,10 +306,12 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="1" B="0.980392158" G="0.294117659" R="0"/> <Color A="1" B="0.980392158" G="0.294117659" R="0"/>
<Linear>true</Linear>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
<Command>PickTeam</Command> <Command>PickTeam</Command>
@@ -334,9 +342,10 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="1" B="0" G="1" R="0.509803951"/> <Color A="1" B="0" G="1" R="0.509803951"/>
<Visible>false</Visible> <Visible>false</Visible>
</c:Sprite> </c:Sprite>
@@ -422,9 +431,10 @@
<Entity name="BackgroundHexagon"> <Entity name="BackgroundHexagon">
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.300000012" B="1" G="1" R="1"/> <Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -441,9 +451,10 @@
<CapturePointNumber>3</CapturePointNumber> <CapturePointNumber>3</CapturePointNumber>
</c:CapturePointHUD> </c:CapturePointHUD>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -458,9 +469,10 @@
<Entity name="BackgroundHexagon"> <Entity name="BackgroundHexagon">
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/> <Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -477,9 +489,10 @@
<CapturePointNumber>4</CapturePointNumber> <CapturePointNumber>4</CapturePointNumber>
</c:CapturePointHUD> </c:CapturePointHUD>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -494,9 +507,10 @@
<Entity name="BackgroundHexagon"> <Entity name="BackgroundHexagon">
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.300000012" B="1" G="1" R="1"/> <Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -513,9 +527,10 @@
<CapturePointNumber>2</CapturePointNumber> <CapturePointNumber>2</CapturePointNumber>
</c:CapturePointHUD> </c:CapturePointHUD>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -530,9 +545,10 @@
<Entity name="BackgroundHexagon"> <Entity name="BackgroundHexagon">
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.300000012" B="1" G="1" R="1"/> <Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -550,9 +566,10 @@
<CapturePointNumber>1</CapturePointNumber> <CapturePointNumber>1</CapturePointNumber>
</c:CapturePointHUD> </c:CapturePointHUD>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -567,9 +584,10 @@
<Entity name="BackgroundHexagon"> <Entity name="BackgroundHexagon">
<Components> <Components>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="0.699999988" B="0" G="0" R="1"/> <Color A="0.699999988" B="0" G="0" R="1"/>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
@@ -584,9 +602,10 @@
</c:Fill> </c:Fill>
<c:CapturePointHUD/> <c:CapturePointHUD/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
</c:Sprite> </c:Sprite>
<c:Transform> <c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/> <Position X="0" Y="0" Z="0.00999999978"/>
@@ -604,9 +623,10 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="1" B="0" G="1" R="0.509803951"/> <Color A="1" B="0" G="1" R="0.509803951"/>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
@@ -651,9 +671,10 @@
<Components> <Components>
<c:Button/> <c:Button/>
<c:Sprite> <c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<DepthSort>false</DepthSort> <DepthSort>false</DepthSort>
<Model>Models/Core/UnitQuad.mesh</Model>
<GlowMap></GlowMap>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<Color A="1" B="0" G="1" R="0.509803951"/> <Color A="1" B="0" G="1" R="0.509803951"/>
</c:Sprite> </c:Sprite>
<c:InputCmdButton> <c:InputCmdButton>
+6 -2
View File
@@ -1271,14 +1271,15 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix())); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "P"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix()));
glUniform3fv(glGetUniformLocation(shaderHandle, "CameraPos"), 1, glm::value_ptr(scene.Camera->Position())); glUniform3fv(glGetUniformLocation(shaderHandle, "CameraPos"), 1, glm::value_ptr(scene.Camera->Position()));
RenderState* jobState = new RenderState();
for(auto& job : jobs) { for(auto& job : jobs) {
auto spriteJob = std::dynamic_pointer_cast<SpriteJob>(job); auto spriteJob = std::dynamic_pointer_cast<SpriteJob>(job);
RenderState jobState;
if (spriteJob) { if (spriteJob) {
if(spriteJob->Depth == 0) { if(spriteJob->Depth == 0) {
jobState.Disable(GL_DEPTH_TEST); jobState->Disable(GL_DEPTH_TEST);
} }
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * spriteJob->Matrix)); glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "PVM"), 1, GL_FALSE, glm::value_ptr(scene.Camera->ProjectionMatrix() * scene.Camera->ViewMatrix() * spriteJob->Matrix));
glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(spriteJob->Color)); glUniform4fv(glGetUniformLocation(shaderHandle, "Color"), 1, glm::value_ptr(spriteJob->Color));
@@ -1294,6 +1295,8 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
glBindTexture(GL_TEXTURE_2D, m_ErrorTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, m_ErrorTexture->m_Texture);
} }
glActiveTexture(GL_TEXTURE2); glActiveTexture(GL_TEXTURE2);
if (spriteJob->IncandescenceTexture != nullptr) { if (spriteJob->IncandescenceTexture != nullptr) {
glBindTexture(GL_TEXTURE_2D, spriteJob->IncandescenceTexture->m_Texture); glBindTexture(GL_TEXTURE_2D, spriteJob->IncandescenceTexture->m_Texture);
@@ -1307,6 +1310,7 @@ void DrawFinalPass::DrawSprites(std::list<std::shared_ptr<RenderJob>>&jobs, Rend
glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex*sizeof(unsigned int))); glDrawElements(GL_TRIANGLES, spriteJob->EndIndex - spriteJob->StartIndex + 1, GL_UNSIGNED_INT, (void*)(spriteJob->StartIndex*sizeof(unsigned int)));
} }
} }
delete jobState;
// m_SpriteProgram->Unbind(); // m_SpriteProgram->Unbind();
} }
+1 -1
View File
@@ -6,6 +6,6 @@ TextureSprite::TextureSprite(std::string path)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERROR("Texture load"); GLERROR("Texture load");
} }