Commit d6189fd1 authored by hybrid's avatar hybrid

Use API functions instead of direct member access.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2505 dfc29bdd-3216-0410-991c-e03cc46cb475
parent c8cc6715
...@@ -308,8 +308,10 @@ void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount, ...@@ -308,8 +308,10 @@ void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount,
// color // color
u32 col;
findNextNoneWhiteSpace(&p); findNextNoneWhiteSpace(&p);
sscanf(p, "%08x", &vtx.Color.color); sscanf(p, "%08x", &col);
vtx.Color.set(col);
skipCurrentNoneWhiteSpace(&p); skipCurrentNoneWhiteSpace(&p);
// tcoord1 // tcoord1
...@@ -345,8 +347,10 @@ void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount, ...@@ -345,8 +347,10 @@ void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount,
// color // color
u32 col;
findNextNoneWhiteSpace(&p); findNextNoneWhiteSpace(&p);
sscanf(p, "%08x", &vtx.Color.color); sscanf(p, "%08x", &col);
vtx.Color.set(col);
skipCurrentNoneWhiteSpace(&p); skipCurrentNoneWhiteSpace(&p);
// tcoord1 // tcoord1
...@@ -390,8 +394,10 @@ void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount, ...@@ -390,8 +394,10 @@ void CIrrMeshFileLoader::readMeshBuffer(io::IXMLReader* reader, int vertexCount,
// color // color
u32 col;
findNextNoneWhiteSpace(&p); findNextNoneWhiteSpace(&p);
sscanf(p, "%08x", &vtx.Color.color); sscanf(p, "%08x", &col);
vtx.Color.set(col);
skipCurrentNoneWhiteSpace(&p); skipCurrentNoneWhiteSpace(&p);
// tcoord1 // tcoord1
......
...@@ -183,7 +183,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer) ...@@ -183,7 +183,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal); str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12]; char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color.color); sprintf(tmp, " %02x%02x%02x%02x ", vtx[j].Color.getAlpha(), vtx[j].Color.getRed(), vtx[j].Color.getBlue(), vtx[j].Color.getGreen());
str += tmp; str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords); str += getVectorAsStringLine(vtx[j].TCoords);
...@@ -203,7 +203,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer) ...@@ -203,7 +203,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal); str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12]; char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color.color); sprintf(tmp, " %02x%02x%02x%02x ", vtx[j].Color.getAlpha(), vtx[j].Color.getRed(), vtx[j].Color.getBlue(), vtx[j].Color.getGreen());
str += tmp; str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords); str += getVectorAsStringLine(vtx[j].TCoords);
...@@ -225,7 +225,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer) ...@@ -225,7 +225,7 @@ void CIrrMeshWriter::writeMeshBuffer(const scene::IMeshBuffer* buffer)
str += getVectorAsStringLine(vtx[j].Normal); str += getVectorAsStringLine(vtx[j].Normal);
char tmp[12]; char tmp[12];
sprintf(tmp, " %08x ", vtx[j].Color.color); sprintf(tmp, " %02x%02x%02x%02x ", vtx[j].Color.getAlpha(), vtx[j].Color.getRed(), vtx[j].Color.getBlue(), vtx[j].Color.getGreen());
str += tmp; str += tmp;
str += getVectorAsStringLine(vtx[j].TCoords); str += getVectorAsStringLine(vtx[j].TCoords);
......
...@@ -1138,11 +1138,11 @@ inline void CQ3LevelMesh::copy( video::S3DVertex2TCoords * dest, const tBSPVerte ...@@ -1138,11 +1138,11 @@ inline void CQ3LevelMesh::copy( video::S3DVertex2TCoords * dest, const tBSPVerte
u32 g = core::s32_min( source->color[1] * LoadParam.defaultModulate, 255 ); u32 g = core::s32_min( source->color[1] * LoadParam.defaultModulate, 255 );
u32 b = core::s32_min( source->color[2] * LoadParam.defaultModulate, 255 ); u32 b = core::s32_min( source->color[2] * LoadParam.defaultModulate, 255 );
dest->Color.color = a << 24 | r << 16 | g << 8 | b; dest->Color.set(a << 24 | r << 16 | g << 8 | b);
} }
else else
{ {
dest->Color.color = 0xFFFFFFFF; dest->Color.set(0xFFFFFFFF);
} }
} }
......
...@@ -456,10 +456,10 @@ void CQuake3ShaderSceneNode::render() ...@@ -456,10 +456,10 @@ void CQuake3ShaderSceneNode::render()
*/ */
switch ( i ) switch ( i )
{ {
case 0: deb_m.EmissiveColor = 0xFFFFFFFF; break; case 0: deb_m.EmissiveColor.set(0xFFFFFFFF); break;
case 1: deb_m.EmissiveColor = 0xFFFF0000; break; case 1: deb_m.EmissiveColor.set(0xFFFF0000); break;
case 2: deb_m.EmissiveColor = 0xFF00FF00; break; case 2: deb_m.EmissiveColor.set(0xFF00FF00); break;
case 3: deb_m.EmissiveColor = 0xFF0000FF; break; case 3: deb_m.EmissiveColor.set(0xFF0000FF); break;
default: default:
deb_m.EmissiveColor = v->Color; break; deb_m.EmissiveColor = v->Color; break;
} }
...@@ -811,13 +811,13 @@ void CQuake3ShaderSceneNode::vertextransform_rgbgen( f32 dt, SModifierFunction & ...@@ -811,13 +811,13 @@ void CQuake3ShaderSceneNode::vertextransform_rgbgen( f32 dt, SModifierFunction &
case IDENTITY: case IDENTITY:
//rgbgen identity //rgbgen identity
for ( i = 0; i != vsize; ++i ) for ( i = 0; i != vsize; ++i )
MeshBuffer->Vertices[i].Color.color = 0xFFFFFFFF; MeshBuffer->Vertices[i].Color.set(0xFFFFFFFF);
break; break;
case IDENTITYLIGHTING: case IDENTITYLIGHTING:
// rgbgen identitylighting TODO: overbright // rgbgen identitylighting TODO: overbright
for ( i = 0; i != vsize; ++i ) for ( i = 0; i != vsize; ++i )
MeshBuffer->Vertices[i].Color.color = 0xFF7F7F7F; MeshBuffer->Vertices[i].Color.set(0xFF7F7F7F);
break; break;
case EXACTVERTEX: case EXACTVERTEX:
...@@ -825,7 +825,7 @@ void CQuake3ShaderSceneNode::vertextransform_rgbgen( f32 dt, SModifierFunction & ...@@ -825,7 +825,7 @@ void CQuake3ShaderSceneNode::vertextransform_rgbgen( f32 dt, SModifierFunction &
case VERTEX: case VERTEX:
// rgbgen vertex // rgbgen vertex
for ( i = 0; i != vsize; ++i ) for ( i = 0; i != vsize; ++i )
MeshBuffer->Vertices[i].Color.color = Original->Vertices[i].Color.color; MeshBuffer->Vertices[i].Color=Original->Vertices[i].Color;
break; break;
case WAVE: case WAVE:
{ {
...@@ -835,15 +835,15 @@ void CQuake3ShaderSceneNode::vertextransform_rgbgen( f32 dt, SModifierFunction & ...@@ -835,15 +835,15 @@ void CQuake3ShaderSceneNode::vertextransform_rgbgen( f32 dt, SModifierFunction &
value = 0xFF000000 | value << 16 | value << 8 | value; value = 0xFF000000 | value << 16 | value << 8 | value;
for ( i = 0; i != vsize; ++i ) for ( i = 0; i != vsize; ++i )
MeshBuffer->Vertices[i].Color.color = value; MeshBuffer->Vertices[i].Color.set(value);
} break; } break;
case CONSTANT: case CONSTANT:
{ {
//rgbgen const ( x y z ) //rgbgen const ( x y z )
video::SColorf cf( function.x, function.y, function.z ); video::SColorf cf( function.x, function.y, function.z );
u32 col = cf.toSColor ().color; video::SColor col = cf.toSColor();
for ( i = 0; i != vsize; ++i ) for ( i = 0; i != vsize; ++i )
MeshBuffer->Vertices[i].Color.color = col; MeshBuffer->Vertices[i].Color=col;
} break; } break;
default: default:
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment