Clean up to the cross platform support in DirectX plugin.

This commit is contained in:
Robert Osfield
2003-01-13 14:11:06 +00:00
parent c3a7ce7352
commit 7ee6d4f3f4
2 changed files with 10 additions and 3 deletions

View File

@@ -145,7 +145,7 @@ osg::Geode* ReaderWriterDirectX::convertFromDX(DX::Object& obj,
*
* - Polys are CW oriented
*/
std::vector<osg::Geometry*> geomList;
vector<osg::Geometry*> geomList;
unsigned int i;
for (i = 0; i < meshMaterial->material.size(); i++) {
@@ -220,7 +220,12 @@ osg::Geode* ReaderWriterDirectX::convertFromDX(DX::Object& obj,
geom->addPrimitiveSet(new osg::DrawArrayLengths(osg::PrimitiveSet::POLYGON));
}
assert(mesh->faces.size() == meshMaterial->faceIndices.size());
if (mesh->faces.size() != meshMaterial->faceIndices.size())
{
osg::notify(osg::FATAL)<<"Error: internal error in DirectX .x loader,"<<std::endl;
osg::notify(osg::FATAL)<<" mesh->faces.size() == meshMaterial->faceIndices.size()"<<std::endl;
return NULL;
}
// Add faces to Geometry
for (i = 0; i < meshMaterial->faceIndices.size(); i++) {

View File

@@ -24,6 +24,8 @@
#ifndef _DIRECTX_H_
#define _DIRECTX_H_
#include <osg/Math>
#include <string>
#include <vector>
#include <fstream>
@@ -40,7 +42,7 @@ namespace DX {
float x,y,z;
inline void normalize() {
float lenRecip = 1.0f / (float) sqrt(x * x + y * y + z * z);
float lenRecip = 1.0f / sqrtf(x * x + y * y + z * z);
x *= lenRecip;
y *= lenRecip;
z *= lenRecip;