11 void throwException(
const std::string& fieldName,
const std::string& expectedFieldType)
14 error +=
"The node must have a field \"" + fieldName +
"\" of " + expectedFieldType +
" type";
15 throw ModelLoader::ModelLoaderException(error.c_str());
33 for(
size_t i=0;
i < strings.size();
i++){
34 out_s += strings[
i] +
"\n";
39 throwException(name,
"SFString or MFString");
51 CORBA::ULong
n = mf.size();
53 for(CORBA::ULong
i=0;
i <
n; ++
i){
59 throwException(name,
"MFFloat");
72 for(
int i = 0;
i < 3; ++
i){
78 throwException(name,
"SFVec3f or SFColor");
90 for(
int i=0;
i < 9; ++
i){
94 throw ModelLoader::ModelLoaderException(
"illegal size of a matrix field");
99 throwException(name,
"MFFloat");
111 throwException(name,
"SFFloat");
124 throwException(name,
"SFInt32");
151 throwException(name,
"SFRotation");
156 const double& theta = r[3];
157 const double sth = sin(theta);
158 const double vth = 1.0 - cos(theta);
165 double l = sqrt(ax*ax + ay*ay + az*az);
175 const double axx = ax*ax*vth;
176 const double ayy = ay*ay*vth;
177 const double azz = az*az*vth;
178 const double axy = ax*ay*vth;
179 const double ayz = ay*az*vth;
180 const double azx = az*ax*vth;
186 out_R[0] = 1.0 - azz - ayy; out_R[1] = -az + axy; out_R[2] = ay + azx;
187 out_R[3] = az + axy; out_R[4] = 1.0 - azz - axx; out_R[5] = -ax + ayz;
188 out_R[6] = -ay + azx; out_R[7] = ax + ayz; out_R[8] = 1.0 - ayy - axx;
199 throwException( name,
"SFRotation" );
204 for(
int i = 0 ;
i < 4 ;
i++ )
213 if( 0 == urls.size() )
216 error +=
"ImageTexture read error: No urls in ImageTexture node";
217 throw ModelLoader::ModelLoaderException(error.c_str());
219 for(
unsigned int i=0;
i<urls.size();
i++){
221 if( !retUrl.empty() )
std::vector< SFFloat > MFFloat
png_infop png_charpp name
std::map< std::string, VrmlVariantField > TProtoFieldMap
void error(char *msg) const
void copyVrmlField(TProtoFieldMap &fmap, const std::string &name, std::string &out_s)
void copyVrmlRotationFieldToDblArray4(TProtoFieldMap &fieldMap, const std::string name, DblArray4 &out_R)
HRP_UTIL_EXPORT void getPathFromUrl(string &refUrl, const string &rootDir, string srcUrl)
boost::array< SFFloat, 3 > SFVec3f
std::vector< SFString > MFString
void copyVrmlRotationFieldToDblArray9(TProtoFieldMap &fieldMap, const std::string name, DblArray9 &out_R)
string setTexturefileUrl(string modelfileDir, MFString urls)