Work on smooth blending.
This commit is contained in:
parent
48094c972a
commit
7b43990aa7
@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||||||
#include "OgrePrerequisites.h"
|
#include "OgrePrerequisites.h"
|
||||||
|
|
||||||
#include "OgreVector3.h"
|
#include "OgreVector3.h"
|
||||||
#include "OgreVector4.h"
|
|
||||||
|
|
||||||
namespace Ogre
|
namespace Ogre
|
||||||
{
|
{
|
||||||
@ -32,7 +31,7 @@ namespace Ogre
|
|||||||
public:
|
public:
|
||||||
Vector3 position;
|
Vector3 position;
|
||||||
Vector3 normal;
|
Vector3 normal;
|
||||||
Vector4 colour;
|
float alpha;
|
||||||
|
|
||||||
Vertex(Vector3 positionToSet)
|
Vertex(Vector3 positionToSet)
|
||||||
:position(positionToSet)
|
:position(positionToSet)
|
||||||
|
@ -6,6 +6,7 @@ struct v2f
|
|||||||
float4 TexCoordsYZ : TEXCOORD1;
|
float4 TexCoordsYZ : TEXCOORD1;
|
||||||
float4 TexCoordsXZ : TEXCOORD2;
|
float4 TexCoordsXZ : TEXCOORD2;
|
||||||
float4 Normal : TEXCOORD3;
|
float4 Normal : TEXCOORD3;
|
||||||
|
float Alpha : TEXCOORD4;
|
||||||
};
|
};
|
||||||
|
|
||||||
float4 main(v2f IN, uniform sampler2D colourMap : TEXUNIT0) : COLOR
|
float4 main(v2f IN, uniform sampler2D colourMap : TEXUNIT0) : COLOR
|
||||||
@ -18,5 +19,5 @@ float4 main(v2f IN, uniform sampler2D colourMap : TEXUNIT0) : COLOR
|
|||||||
|
|
||||||
//colourMapValue /= 3.0;
|
//colourMapValue /= 3.0;
|
||||||
|
|
||||||
return float4(colourMapValue/*IN.Color.rgb*/, pow(IN.Color.a,0.75));
|
return float4(colourMapValue*IN.Color.rgb,pow(IN.Alpha,0.75));
|
||||||
}
|
}
|
@ -9,7 +9,7 @@ struct a2v
|
|||||||
{
|
{
|
||||||
float4 Position : POSITION; //in object space
|
float4 Position : POSITION; //in object space
|
||||||
float3 Normal : NORMAL;
|
float3 Normal : NORMAL;
|
||||||
float4 Color : COLOR;
|
float Alpha : TEXCOORD0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct v2f
|
struct v2f
|
||||||
@ -20,6 +20,7 @@ struct v2f
|
|||||||
float4 TexCoordsYZ : TEXCOORD1;
|
float4 TexCoordsYZ : TEXCOORD1;
|
||||||
float4 TexCoordsXZ : TEXCOORD2;
|
float4 TexCoordsXZ : TEXCOORD2;
|
||||||
float4 Normal : TEXCOORD3;
|
float4 Normal : TEXCOORD3;
|
||||||
|
float Alpha : TEXCOORD4;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct light
|
struct light
|
||||||
@ -96,11 +97,10 @@ v2f doWork(a2v IN, float4x4 world, float4x4 viewProj, float textureScale, float4
|
|||||||
}
|
}
|
||||||
|
|
||||||
OUT.Color.rgb += ambient.rgb;
|
OUT.Color.rgb += ambient.rgb;
|
||||||
|
|
||||||
//Temporary
|
|
||||||
OUT.Color = IN.Color;
|
|
||||||
|
|
||||||
OUT.Position = mul(viewProj, OUT.Position);
|
OUT.Position = mul(viewProj, OUT.Position);
|
||||||
|
|
||||||
|
OUT.Alpha = IN.Alpha;
|
||||||
|
|
||||||
return OUT;
|
return OUT;
|
||||||
}
|
}
|
||||||
|
@ -773,9 +773,9 @@ namespace Ogre
|
|||||||
//Add the vertex
|
//Add the vertex
|
||||||
Vertex vertex(vertex0);
|
Vertex vertex(vertex0);
|
||||||
if(material0 == material)
|
if(material0 == material)
|
||||||
vertex.colour = Vector4(1.0,1.0,1.0,1.0);
|
vertex.alpha = 1.0;
|
||||||
else
|
else
|
||||||
vertex.colour = Vector4(0.0,0.0,0.0,0.0);
|
vertex.alpha = 0.0;
|
||||||
vertexData[material].push_back(Vertex(vertex));
|
vertexData[material].push_back(Vertex(vertex));
|
||||||
triangle.v0 = vertexData[material].size()-1;
|
triangle.v0 = vertexData[material].size()-1;
|
||||||
vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1;
|
vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1;
|
||||||
@ -800,9 +800,9 @@ namespace Ogre
|
|||||||
//Add the vertex
|
//Add the vertex
|
||||||
Vertex vertex(vertex1);
|
Vertex vertex(vertex1);
|
||||||
if(material1 == material)
|
if(material1 == material)
|
||||||
vertex.colour = Vector4(1.0,1.0,1.0,1.0);
|
vertex.alpha = 1.0;
|
||||||
else
|
else
|
||||||
vertex.colour = Vector4(0.0,0.0,0.0,0.0);
|
vertex.alpha = 0.0;
|
||||||
vertexData[material].push_back(Vertex(vertex));
|
vertexData[material].push_back(Vertex(vertex));
|
||||||
triangle.v1 = vertexData[material].size()-1;
|
triangle.v1 = vertexData[material].size()-1;
|
||||||
vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1;
|
vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1;
|
||||||
@ -827,9 +827,9 @@ namespace Ogre
|
|||||||
//Add the vertex
|
//Add the vertex
|
||||||
Vertex vertex(vertex2);
|
Vertex vertex(vertex2);
|
||||||
if(material2 == material)
|
if(material2 == material)
|
||||||
vertex.colour = Vector4(1.0,1.0,1.0,1.0);
|
vertex.alpha = 1.0;
|
||||||
else
|
else
|
||||||
vertex.colour = Vector4(0.0,0.0,0.0,0.0);
|
vertex.alpha = 0.0;
|
||||||
vertexData[material].push_back(Vertex(vertex));
|
vertexData[material].push_back(Vertex(vertex));
|
||||||
triangle.v2 = vertexData[material].size()-1;
|
triangle.v2 = vertexData[material].size()-1;
|
||||||
vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1;
|
vertexIndices[vertexScaledX][vertexScaledY][vertexScaledZ][material] = vertexData[material].size()-1;
|
||||||
|
@ -40,7 +40,7 @@ namespace Ogre
|
|||||||
decl->removeAllElements();
|
decl->removeAllElements();
|
||||||
decl->addElement(0, 0, VET_FLOAT3, VES_POSITION);
|
decl->addElement(0, 0, VET_FLOAT3, VES_POSITION);
|
||||||
decl->addElement(0, 3 * sizeof(float), VET_FLOAT3, VES_NORMAL);
|
decl->addElement(0, 3 * sizeof(float), VET_FLOAT3, VES_NORMAL);
|
||||||
decl->addElement(0, 6 * sizeof(float), VET_FLOAT4, VES_DIFFUSE);
|
decl->addElement(0, 6 * sizeof(float), VET_FLOAT1, VES_TEXTURE_COORDINATES);
|
||||||
|
|
||||||
//LogManager::getSingleton().logMessage("Creating Vertex Buffer");
|
//LogManager::getSingleton().logMessage("Creating Vertex Buffer");
|
||||||
HardwareVertexBufferSharedPtr vbuf =
|
HardwareVertexBufferSharedPtr vbuf =
|
||||||
@ -81,10 +81,7 @@ namespace Ogre
|
|||||||
*prPos++ = verticesToSet[i].normal.y;
|
*prPos++ = verticesToSet[i].normal.y;
|
||||||
*prPos++ = verticesToSet[i].normal.z;
|
*prPos++ = verticesToSet[i].normal.z;
|
||||||
|
|
||||||
*prPos++ = verticesToSet[i].colour.x;
|
*prPos++ = verticesToSet[i].alpha;
|
||||||
*prPos++ = verticesToSet[i].colour.y;
|
|
||||||
*prPos++ = verticesToSet[i].colour.z;
|
|
||||||
*prPos++ = verticesToSet[i].colour.w;
|
|
||||||
|
|
||||||
if(verticesToSet[i].position.x < vaabMin.x)
|
if(verticesToSet[i].position.x < vaabMin.x)
|
||||||
vaabMin.x = verticesToSet[i].position.x;
|
vaabMin.x = verticesToSet[i].position.x;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user