25 #define LOGSTREAM Ogre::LogManager::getSingleton().stream() << "[RoR|TObj fileformat] "
75 if ((line !=
nullptr) && (line[0] != 0) && (line[0] !=
'/') && (line[0] !=
';'))
98 if (strncmp(
m_cur_line,
"collision-tris", 14) == 0)
117 if (strncmp(
m_cur_line,
"set_default_rendering_distance", 30) == 0)
131 if (strncmp(
"begin_procedural_roads",
m_cur_line, 22) == 0)
138 if (strncmp(
"end_procedural_roads",
m_cur_line, 20) == 0)
168 if (
object.IsActor())
172 else if (
object.IsRoad())
178 m_def->objects.push_back(
object);
198 std::shared_ptr<TObjFile> tmp_def =
m_def;
207 bool keep_reading =
true;
208 while (keep_reading && !stream->eof())
222 Ogre::Vector3 rot = Ogre::Vector3::ZERO;
223 sscanf(
m_cur_line,
"%f, %f, %f, %f, %f, %f, %f, %f, %f, %s",
225 &rot.x, &rot.y, &rot.z,
245 Ogre::Vector3 & pos =
m_def->grid_position;
246 sscanf(
m_cur_line,
"grid %f, %f, %f", &pos.x, &pos.y, &pos.z);
247 m_def->grid_enabled =
true;
253 sscanf(
m_cur_line,
"trees %f, %f, %f, %f, %f, %f, %f, %s %s %s %f %s",
261 m_def->trees.push_back(tree);
269 sscanf(
m_cur_line,
"grass2 %d, %f, %f, %f, %f, %f, %f, %f, %f, %d, %f, %f, %d, %s %s %s",
281 sscanf(
m_cur_line,
"grass %d, %f, %f, %f, %f, %f, %f, %f, %f, %d, %f, %f, %s %s %s",
296 LOGSTREAM <<
"Invalid parameter 'technique': '" << grass.
technique <<
"', falling back to default '1: GRASSTECH_CROSSQUADS'";
300 m_def->grass.push_back(grass);
308 v.
type =
object.special;
309 strcpy(v.
name,
object.type);
311 m_def->vehicles.push_back(v);
365 return Quaternion(Degree(rot.y), Vector3::UNIT_Y) *
366 Quaternion(Degree(rot.x), Vector3::UNIT_X) *
367 Quaternion(Degree(rot.z), Vector3::UNIT_Z);
371 return Quaternion(Degree(rot.x), Vector3::UNIT_X) *
372 Quaternion(Degree(rot.y), Vector3::UNIT_Y) *
373 Quaternion(Degree(rot.z), Vector3::UNIT_Z);
382 Ogre::Vector3 pos(Ogre::Vector3::ZERO);
383 Ogre::Vector3 rot(Ogre::Vector3::ZERO);
384 int r = sscanf(
m_cur_line,
"%f, %f, %f, %f, %f, %f, %s %s %s",
385 &pos.x, &pos.y, &pos.z, &rot.x, &rot.y, &rot.z, odef.
GetBuffer(), type, name);