So I looked at this post:
viewtopic.php?p=450#p450and then followed the tutorial:
http://www.ogre3d.org/tikiwiki/Getting+ ... +Materialsand so what I have is ColoredCubicVoxel.material
Code:
vertex_program ColouredCubicVoxelVP cg
{
source ColouredCubicVoxel.cg
entry_point ColouredCubicVoxelVP
profiles vs_3_0 vs_2_x vs_2_0 vs_1_1 vp40 vp30 vp20 arbvp1
default_params
{
param_named_auto world world_matrix
param_named_auto viewProj viewproj_matrix
}
}
fragment_program ColouredCubicVoxelFP cg
{
source ColouredCubicVoxel.cg
entry_point ColouredCubicVoxelFP
profiles ps_3_x ps_3_0 ps_2_x ps_2_0 ps_1_4 ps_1_3 ps_1_2 ps_1_1 fp40 fp30 fp20 arbfp1
default_params
{
}
}
material ColouredCubicVoxel
{
technique
{
pass
{
// Vertex program reference
vertex_program_ref ColouredCubicVoxelVP
{
}
// Fragment program
fragment_program_ref ColouredCubicVoxelFP
{
}
texture_unit
{
texture Dirt.jpg 2d
filtering anisotropic
max_anisotropy 16
}
}
}
}
and ColouredCubicVoxel.cg
Code:
void ColouredCubicVoxelVP(
float4 inPosition : POSITION,
float4 inNormal : NORMAL,
out float4 outClipPosition : POSITION,
out float4 outWorldPosition : TEXCOORD0,
out float4 outWorldNormal : TEXCOORD1,
uniform float4x4 world,
uniform float4x4 viewProj
)
{
//Compute the world space position
outWorldPosition = mul(world, inPosition);
//Just pass though the normals without transforming them in any way. No rotation occurs.
outWorldNormal = inNormal;
//Compute the clip space position
outClipPosition = mul(viewProj, outWorldPosition);
}
void ColouredCubicVoxelFP(
float4 inPosition : POSITION,
float4 inWorldPosition : TEXCOORD0,
float4 inWorldNormal : TEXCOORD1,
uniform sampler2D heightMap : TEXUNIT0,
out float4 result : COLOR)
{
inWorldNormal = normalize(inWorldNormal);
float3 col;
//World position is used as texture coordinates. Choose which
//two components of world position to use based on normal. Could
//optionally use a different texture for each face here as well.
if(inWorldNormal. x > 0.5)
{
col = tex2D(heightMap, inWorldPosition.yz);
}
if(inWorldNormal. x < -0.5)
{
col = tex2D(heightMap, inWorldPosition.yz);
}
if(inWorldNormal. y > 0.5)
{
col = tex2D(heightMap, inWorldPosition.xz);
}
if(inWorldNormal. y < -0.5)
{
col = tex2D(heightMap, inWorldPosition.xz);
}
if(inWorldNormal. z > 0.5)
{
col = tex2D(heightMap, inWorldPosition.xy);
}
if(inWorldNormal. z < -0.5)
{
col = tex2D(heightMap, inWorldPosition.xy);
}
result = float4(col, 1.0);
}
and I call it in my program with
Code:
PVWorld->convertToMesh(Ogre::String("Sphere"));
Ogre::Entity* lEntity = mSceneMgr->createEntity(Ogre::String("Sphere"));
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
lEntity->setMaterialName("ColouredCubicVoxel");
node->attachObject(lEntity);
and I get massive massive errors, that I have no idea what they mean. The only thing that means anything to me is invalidparametersexception, but I don't see where I'm supposed to be putting stuff in