56#include <RTShaderSystem/OgreRTShaderSystem.h>
57#include <Overlay/OgreFontManager.h>
76 terrainManager(terrainManager)
93 delete geom->getPageLoader();
105 Ogre::ColourValue background_color(Ogre::ColourValue::White);
106 Ogre::ColourValue grid_color(0.2f, 0.2f, 0.2f, 1.0f);
108 Ogre::ManualObject* mo =
new Ogre::ManualObject(
"ReferenceGrid");
110 mo->begin(
"BaseWhiteNoLighting", Ogre::RenderOperation::OT_LINE_LIST);
112 const float step = 1.0f;
113 const size_t count = 50;
114 unsigned int halfCount = count / 2;
115 const float half = (step * count) / 2;
118 for (
size_t i=0; i < count+1; i++)
121 c = Ogre::ColourValue(1.f, 0.f, 0.f, 1.f);
125 mo->position(-half,
y, -half+(step*i));
126 mo->colour(background_color);
127 mo->position(0,
y, -half+(step*i));
129 mo->position(0,
y, -half+(step*i));
131 mo->position(half,
y, -half+(step*i));
132 mo->colour(background_color);
135 c = Ogre::ColourValue(0,0,1,1.0f);
139 mo->position(-half+(step*i),
y, -half);
140 mo->colour(background_color);
141 mo->position(-half+(step*i),
y, 0);
143 mo->position(-half+(step*i),
y, 0);
145 mo->position(-half+(step*i),
y, half);
146 mo->colour(background_color);
150 mo->setCastShadows(
false);
152 n->setPosition(position);
166 DataStreamPtr stream_ptr = ResourceGroupManager::getSingleton().openResource(
187 if (tobj->grid_enabled)
201 fmt::format(
"Paged Grass ({}, line {})", tobj->document_name, tree.origin_tobj_line_number));
204 tree.yaw_from, tree.yaw_to,
205 tree.scale_from, tree.scale_to,
206 tree.color_map, tree.density_map, tree.tree_mesh, tree.collision_mesh,
207 tree.grid_spacing, tree.high_density,
208 tree.min_distance, tree.max_distance, mapsizex, mapsizez,
209 trees_grouping_node);
227 fmt::format(
"Paged Grass ({}, line {})", tobj->document_name, grass.origin_tobj_line_number));
230 grass.sway_speed, grass.sway_length, grass.sway_distrib, grass.density,
231 grass.min_x, grass.min_y, grass.min_h,
232 grass.max_x, grass.max_y, grass.max_h,
233 grass.material_name, grass.color_map_filename, grass.density_map_filename,
234 grass.fadetech, grass.technique, grass.range, mapsizex, mapsizez,
235 grass_grouping_node);
239 RoR::HandleGenericException(fmt::format(
"Error processing 'grass' line (material: {}) from TOBJ file {}", grass.material_name, tobj_name));
271 this->
LoadTerrainObject(entry.odef_name, entry.position, entry.rotation, entry.instance_name, entry.type, entry.rendering_distance);
293 float yawfrom,
float yawto,
294 float scalefrom,
float scaleto,
296 float gridspacing,
float highdens,
297 int minDist,
int maxDist,
int mapsizex,
int mapsizez,
298 Ogre::SceneNode* pagedGroupingNode)
303 LOG(
"tree ColorMap map zero!");
308 LOG(
"tree DensityMap zero!");
324 Ogre::TRect<Ogre::Real> bounds =
TBounds(0, 0, mapsizex, mapsizez);
338 if (max / 10 > min / 2)
358 for (
float x=0;
x < mapsizex;
x += gridspacing)
360 for (
float z=0;
z < mapsizez;
z += gridspacing)
363 if (density < 0.8f)
continue;
364 float nx =
x + gridspacing * 0.5f;
365 float nz =
z + gridspacing * 0.5f;
366 float yaw = Math::RangeRandom(yawfrom, yawto);
367 float scale = Math::RangeRandom(scalefrom, scaleto);
368 Vector3 pos = Vector3(nx, 0, nz);
369 treeLoader->
addTree(curTree, pos, Degree(yaw), (Ogre::Real)scale);
370 if (strlen(treeCollmesh))
382 if (gridspacing < 0 && gridspacing != 0)
384 gridsize = -gridspacing;
388 for (
float x=0;
x < mapsizex;
x += gridsize)
390 for (
float z=0;
z < mapsizez;
z += gridsize)
392 if (highdens < 0) hd = Math::RangeRandom(0, -highdens);
396 while(numTreesToPlace-->0)
398 nx = Math::RangeRandom(
x,
x + gridsize);
399 nz = Math::RangeRandom(
z,
z + gridsize);
400 float yaw = Math::RangeRandom(yawfrom, yawto);
401 float scale = Math::RangeRandom(scalefrom, scaleto);
402 Vector3 pos = Vector3(nx, 0, nz);
403 treeLoader->
addTree(curTree, pos, Degree(yaw), (Ogre::Real)scale);
404 if (strlen(treeCollmesh))
418 float SwaySpeed,
float SwayLength,
float SwayDistribution,
float Density,
419 float minx,
float miny,
float minH,
float maxx,
float maxy,
float maxH,
420 char* grassmat,
char* colorMapFilename,
char* densityMapFilename,
422 int range,
int mapsizex,
int mapsizez,
423 Ogre::SceneNode* pagedGroupingNode)
440 grassLoader->setRenderQueueGroup(RENDER_QUEUE_MAIN-1);
442 GrassLayer* grassLayer = grassLoader->addLayer(grassmat);
456 if (strcmp(colorMapFilename,
"none") != 0)
462 if (strcmp(densityMapFilename,
"none") != 0)
477 LOG(
"error loading grass!");
489 dst->position = position;
490 dst->rotation = rotation;
491 dst->special_object_type = type;
493 dst->tobj_cache_id = tobj_cache_id;
506 LOG(fmt::format(
"[RoR] `moveObjectVisuals()`: instance name '{}' not found!", instancename));
518 LOG(fmt::format(
"[RoR] `destroyObject()`: instance name '{}' not found!", instancename));
528 ROR_ASSERT(!object->static_collision_tris.size());
529 ROR_ASSERT(!object->static_collision_boxes.size());
540 for (Ogre::MovableObject* mova :
object->static_object_node->getAttachedObjects())
547 for (
int tri :
object->static_collision_tris)
551 for (
int box :
object->static_collision_boxes)
573 return search_res->second.get();
577 const std::string filename = odef_name +
".odef";
578 std::string group_name;
581 group_name = Ogre::ResourceGroupManager::getSingleton().findGroupContainingResource(filename);
585 LOG(fmt::format(
"[ODEF] Could not find {} in any resource group", filename));
592 Ogre::DataStreamPtr ds = ResourceGroupManager::getSingleton().openResource(filename, group_name);
596 std::shared_ptr<ODefDocument> odef = parser.
Finalize();
604 LOG(fmt::format(
"[ODEF] An exception occurred when loading or parsing {}", filename));
609bool TerrainObjectManager::LoadTerrainObject(
const Ogre::String& name,
const Ogre::Vector3& pos,
const Ogre::Vector3& rot,
const Ogre::String& instancename,
const Ogre::String& type,
float rendering_distance ,
bool enable_collisions ,
int scripthandler ,
bool uniquifyMaterial )
614 for (
int x = 0;
x < 500;
x += 50)
616 for (
int z = 0;
z < 500;
z += 50)
618 const String notype =
"";
619 LoadTerrainObject(name, pos + Vector3(
x, 0.0f,
z), rot, name, notype, 0, enable_collisions, scripthandler, uniquifyMaterial);
625 const std::string odefname = name +
".odef";
633 fmt::format(
_L(
"Could not load file '{}'"), odefname));
648 mo->
getEntity()->setRenderingDistance(rendering_distance);
658 fmt::format(
_L(
"Could not load mesh '{}' (used by object '{}')"), odef->
header.
mesh_name, odefname));
664 tenode->setPosition(pos);
665 Quaternion rotation = Quaternion(Degree(rot.x), Vector3::UNIT_X) * Quaternion(Degree(rot.y), Vector3::UNIT_Y) * Quaternion(Degree(rot.z), Vector3::UNIT_Z);
666 tenode->rotate(rotation);
667 tenode->pitch(Degree(-90));
668 tenode->setVisible(
true);
672 object->instance_name = instancename;
674 object->position = pos;
675 object->rotation = rot;
676 object->initial_position = pos;
677 object->initial_rotation = rot;
678 object->static_object_node = tenode;
679 object->enable_collisions = enable_collisions;
680 object->script_handler = scripthandler;
684 if (mo && uniquifyMaterial && !instancename.empty())
686 for (
unsigned int i = 0; i < mo->
getEntity()->getNumSubEntities(); i++)
688 SubEntity* se = mo->
getEntity()->getSubEntity(i);
689 String matname = se->getMaterialName();
690 String newmatname = matname +
"/" + instancename;
691 se->getMaterial()->clone(newmatname);
692 se->setMaterialName(newmatname);
699 loc.
position = Vector3(pos.x, pos.y, pos.z);
707 tenode->pitch(Degree(90));
713 for (std::string& snd_name : odef->
sounds)
727 bool race_event = !
object->instance_name.compare(0, 10,
"checkpoint") ||
728 !
object->instance_name.compare(0, 4,
"race");
732 String type =
"checkpoint";
733 auto res = StringUtil::split(object->instance_name,
"|");
734 if ((res.size() == 4 && res[2] ==
"0") || !object->instance_name.compare(0, 4,
"race"))
738 int race_id = res.size() > 1 ? StringConverter::parseInt(res[1], -1) : -1;
741 else if (object->type !=
"" && object->type !=
"-")
744 if (object->type ==
"station" || object->type ==
"hotel" || object->type ==
"village" ||
745 object->type ==
"observatory" || object->type ==
"farm" || object->type ==
"ship" || object->type ==
"sign")
747 caption =
object->instance_name +
" " +
object->type;
749 m_map_entities.push_back(
SurveyMapEntity(object->type, caption, fmt::format(
"icon_{}.dds", object->type),
"", object->position, Ogre::Radian(0), -1));
756 if (cmesh.mesh_name ==
"")
758 LOG(
"[ODEF] Skipping collision mesh with empty name. Object: " + odefname);
765 cmesh.mesh_name, pos, tenode->getOrientation(),
766 cmesh.scale, gm, &(object->static_collision_tris));
773 String paname = String(psys.instance_name);
779 pParticleSys->setCastShadows(
false);
783#ifdef USE_ANGELSCRIPT
784 unsigned short affCount = pParticleSys->getNumAffectors();
785 ParticleAffector* pAff;
786 for (
unsigned short i = 0; i < affCount; ++i)
788 pAff = pParticleSys->getAffector(i);
789 if (pAff->getType() ==
"ExtinguishableFire")
796 SceneNode* sn = tenode->createChildSceneNode();
797 sn->attachObject(pParticleSys);
798 sn->pitch(Degree(90));
802 peo.
psys = pParticleSys;
816 Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create(odef->
mat_name_generate,
"generatedMaterialShaders");
817 Ogre::RTShader::ShaderGenerator::getSingleton().createShaderBasedTechnique(*mat, Ogre::MaterialManager::DEFAULT_SCHEME_NAME, Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
818 Ogre::RTShader::ShaderGenerator::getSingleton().invalidateMaterial(RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME, String(odef->
mat_name_generate));
825 AnimationStateSet *s = mo->
getEntity()->getAllAnimationStates();
826 String anim_name_str(anim.name);
827 if (!s->hasAnimationState(anim_name_str))
829 LOG(
"[ODEF] animation '" + anim_name_str +
"' for mesh: '" + odef->
header.
mesh_name +
"' in odef file '" + name +
".odef' not found!");
836 if (anim.speed_min != anim.speed_max)
837 ao.
speedfactor = Math::RangeRandom(anim.speed_min, anim.speed_max);
848 LOG(
"[ODEF] animation '" + anim_name_str +
"' for mesh: '" + odef->
header.
mesh_name +
"' in odef file '" + name +
".odef' not found!");
851 ao.
anim->setEnabled(
true);
860 String matName = mo->
getEntity()->getSubEntity(0)->getMaterialName();
861 MaterialPtr m = MaterialManager::getSingleton().getByName(matName);
864 LOG(
"[ODEF] problem with drawTextOnMeshTexture command: mesh material not found: "+odefname+
" : "+matName);
867 String texName = m->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getTextureName();
868 Texture* background = (Texture *)TextureManager::getSingleton().getByName(texName).get();
871 LOG(
"[ODEF] problem with drawTextOnMeshTexture command: mesh texture not found: "+odefname+
" : "+texName);
875 static int textureNumber = 0;
877 char tmpTextName[256] =
"", tmpMatName[256] =
"";
878 sprintf(tmpTextName,
"TextOnTexture_%d_Texture", textureNumber);
879 sprintf(tmpMatName,
"TextOnTexture_%d_Material", textureNumber);
880 TexturePtr texture = TextureManager::getSingleton().createManual(tmpTextName, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_2D, (Ogre::uint)background->getWidth(), (Ogre::uint)background->getHeight(), MIP_UNLIMITED, PF_X8R8G8B8, Ogre::TU_STATIC | Ogre::TU_AUTOMIPMAP);
881 if (texture.get() == 0)
883 LOG(
"[ODEF] problem with drawTextOnMeshTexture command: could not create texture: "+odefname+
" : "+tmpTextName);
887 Str<200> text_buf; text_buf << tex_print.text;
890 if (!strncmp(text_buf.
GetBuffer(),
"{{argument1}}", 13))
893 text_buf << instancename;
897 char *text_pointer = text_buf.
GetBuffer();
898 while (*text_pointer!=0) {
if (*text_pointer==
'_') *text_pointer=
' ';text_pointer++;};
900 String font_name_str(tex_print.font_name);
901 Ogre::Font* font = (Ogre::Font *)FontManager::getSingleton().getByName(font_name_str).get();
904 LOG(
"[ODEF] problem with drawTextOnMeshTexture command: font not found: "+odefname+
" : "+font_name_str);
909 texture->getBuffer()->blit(background->getBuffer());
911 float x = background->getWidth() * tex_print.x;
912 float y = background->getHeight() * tex_print.y;
913 float w = background->getWidth() * tex_print.w;
914 float h = background->getHeight() * tex_print.h;
916 ColourValue color(tex_print.r, tex_print.g, tex_print.b, tex_print.a);
917 Ogre::Box box = Ogre::Box((
size_t)
x, (
size_t)
y, (
size_t)(
x+
w), (
size_t)(
y+h));
918 WriteToTexture(text_buf.
ToCStr(), texture, box, font, color, tex_print.font_size, tex_print.font_dpi, tex_print.option);
923 m->clone(tmpMatName);
924 MaterialPtr mNew = MaterialManager::getSingleton().getByName(tmpMatName);
925 mNew->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(tmpTextName);
927 mo->
getEntity()->setMaterialName(String(tmpMatName));
934 spotLight->setType(Light::LT_SPOTLIGHT);
935 spotLight->setPosition(spotl.pos);
936 spotLight->setDirection(spotl.dir);
937 spotLight->setAttenuation(spotl.range, 1.0, 0.3, 0.0);
938 spotLight->setDiffuseColour(spotl.color);
939 spotLight->setSpecularColour(spotl.color);
940 spotLight->setSpotlightRange(Degree(spotl.angle_inner), Degree(spotl.angle_outer));
943 lflare->createBillboard(spotl.pos, spotl.color);
944 lflare->setMaterialName(
"tracks/flare");
947 float fsize = Math::Clamp(spotl.range / 10, 0.2f, 2.0f);
948 lflare->setDefaultDimensions(fsize, fsize);
950 SceneNode *sn = tenode->createChildSceneNode();
951 sn->attachObject(spotLight);
952 sn->attachObject(lflare);
959 pointlight->setType(Light::LT_POINT);
960 pointlight->setPosition(plight.pos);
961 pointlight->setDirection(plight.dir);
962 pointlight->setAttenuation(plight.range, 1.0, 0.3, 0.0);
963 pointlight->setDiffuseColour(plight.color);
964 pointlight->setSpecularColour(plight.color);
967 lflare->createBillboard(plight.pos, plight.color);
968 lflare->setMaterialName(
"tracks/flare");
971 float fsize = Math::Clamp(plight.range / 10, 0.2f, 2.0f);
972 lflare->setDefaultDimensions(fsize, fsize);
974 SceneNode *sn = tenode->createChildSceneNode();
975 sn->attachObject(pointlight);
976 sn->attachObject(lflare);
998 std::vector<AnimatedObject>::iterator it;
1002 if (it->anim && it->speedfactor != 0)
1004 Real time = dt * it->speedfactor;
1005 it->anim->addTime(time);
1032 if (object->tobj_cache_id == -1 || object->tobj_cache_id >= (
int)
m_tobj_cache.size())
1035 fmt::format(
"Assuming no 'rot_yxz' when spawning preselected actor '{}' - TOBJ document not found", object->getName()));
1063 object->actor_instance_id);
1126 if (cbox.aabb_min.x > cbox.aabb_max.x || cbox.aabb_min.y > cbox.aabb_max.y || cbox.aabb_min.z > cbox.aabb_max.z)
1129 std::string msg =
"Skipping invalid collision box, min: " +
TOSTRING(cbox.aabb_min) +
", max: " +
TOSTRING(cbox.aabb_max);
1136 LOG(fmt::format(
"[ODEF] {}", msg));
1142 cbox.is_rotating, cbox.is_virtual, params->position, params->rotation,
1143 cbox.aabb_min, cbox.aabb_max, cbox.box_rot, cbox.event_name,
1144 params->instance_name, cbox.reverb_preset_name, cbox.force_cam_pos,
1145 cbox.cam_pos, cbox.scale, cbox.direction, cbox.event_filter,
1146 params->script_handler);
1148 obj->static_collision_boxes.push_back(boxnum);
1172 [needle_instance_name](
TerrainEditorObjectPtr& obj) { return obj->instance_name == needle_instance_name; });
Central state/object manager and communications hub.
#define ROR_ASSERT(_EXPR)
void LOG(const char *msg)
Legacy alias - formerly a macro.
BatchPage is an extension to PagedGeometry which displays entities as static geometry.
A database of user-installed content alias 'mods' (vehicles, terrains...)
Game state manager and message-queue provider.
float getTerrainHeight(Real x, Real z, void *unused=0)
void GenerateGridAndPutToScene(Ogre::Vector3 position)
void WriteToTexture(const String &str, TexturePtr destTexture, Ogre::Box destRectangle, Ogre::Font *Reffont, const ColourValue &color, int fontSize, int fontDPI, char justify, bool wordwrap)
The BatchPage class renders entities as StaticGeometry.
A 2D greyscale image that is assigned to a certain region of your world to represent color levels.
A 2D greyscale image that is assigned to a certain region of your world to represent density levels.
static DensityMap * load(const Ogre::String &fileName, MapChannel channel=CHANNEL_COLOR)
void setFilter(MapFilter filter)
Sets the filtering mode used for this density map.
Ogre::Real _getDensityAt_Unfiltered(Ogre::Real x, Ogre::Real z, const Ogre::TRect< Ogre::Real > &mapBounds)
A data structure giving you full control over grass properties.
void setColorMapFilter(MapFilter filter)
Sets the filtering mode used for color maps.
void setMaximumSize(float width, float height)
Sets the maximum size that grass quads/billboards will be.
void setDensityMapFilter(MapFilter filter)
Sets the filtering mode used for density maps.
void setColorMap(const Ogre::String &mapFile, MapChannel channel=CHANNEL_COLOR)
Sets the color map used for this grass layer.
void setSwayDistribution(Ogre::Real freq)
Sets the smooth distribution (positional phase shift) of the grass swaying animation.
void setLightingEnabled(bool enabled)
Enables/disables lighting on this layer.
void setRenderTechnique(GrassTechnique style, bool blendBase=false)
Sets the technique used to render this grass layer.
void setSwaySpeed(Ogre::Real speed)
Sets the sway speed of the grass (measured in "sways-per-second")
void setMapBounds(const TBounds &bounds)
Sets the boundaries of the density/color maps.
void setMinimumSize(float width, float height)
Sets the minimum size that grass quads/billboards will be.
void setDensity(float density)
Sets the maximum density (measured in grass quads/billboards per square unit) of grass.
void setFadeTechnique(FadeTechnique style)
Sets the technique used when fading out distant grass.
void setHeightRange(float minHeight, float maxHeight=0)
Sets a minimum / maximum height where grass may appear.
void setAnimationEnabled(bool enabled)
Enables/disables animation on this layer.
void setDensityMap(const Ogre::String &mapFile, MapChannel channel=CHANNEL_COLOR)
Sets the density map used for this grass layer.
void setSwayLength(Ogre::Real mag)
Sets how far grass should sway back and forth.
A PageLoader-derived object you can use with PagedGeometry to produce realistic grass.
A custom page type designed specifically for use with GrassLoader.
The ImpostorPage class renders entities as impostors (billboard images that look just like the real e...
A class providing highly optimized methods for rendering massive amounts of geometry.
void setCamera(Ogre::Camera *cam)
Sets the camera to use when calculating levels of detail.
void setTempDir(Ogre::String dir)
Sets the output directory for the imposter pages.
void setPageLoader(PageLoader *loader)
Assigns a PageLoader object for the PagedGeometry.
GeometryPageManager * addDetailLevel(Ogre::Real maxRange, Ogre::Real transitionLength=0, const Ogre::Any &data=Ogre::Any())
Adds a detail level to the PagedGeometry object.
void setInfinite()
Switches to infinite mode.
void setBounds(const TBounds bounds)
Switches to bounded mode and uses the given boundaries.
A PageLoader-derived object you can use with PagedGeometry to easily place trees on your terrain.
void setMaximumScale(Ogre::Real maxScale)
Sets the maximum tree scale value.
void setMinimumScale(Ogre::Real minScale)
Sets the minimum tree scale value.
void setColorMap(const Ogre::String &mapFile, MapChannel channel=CHANNEL_COLOR)
Sets the color map used to color trees.
void setHeightFunction(Ogre::Real(*heightFunction)(Ogre::Real x, Ogre::Real z, void *userData), void *userData=NULL)
Sets the height function used to calculate tree height coordinates.
void addTree(Ogre::Entity *entity, const Ogre::Vector3 &position, Ogre::Degree yaw=Ogre::Degree(0), Ogre::Real scale=1.0f, void *userData=NULL)
Adds an entity to the scene with the specified location, rotation, and scale.
Ogre::Entity * getEntity()
This class defines a ParticleAffector which deflects particles.
const ActorPtr & GetActorById(ActorInstanceID_t actor_id)
ActorInstanceID_t GetActorNextInstanceId()
Script proxy: game.getActorNextInstanceId()
static const ActorPtr ACTORPTR_NULL
Ogre::String resource_group
Resource group of the loaded bundle. Empty if not loaded yet.
int addCollisionBox(bool rotating, bool virt, Ogre::Vector3 pos, Ogre::Vector3 rot, Ogre::Vector3 l, Ogre::Vector3 h, Ogre::Vector3 sr, const Ogre::String &eventname, const Ogre::String &instancename, const Ogre::String &reverb_preset_name, bool forcecam, Ogre::Vector3 campos, Ogre::Vector3 sc=Ogre::Vector3::UNIT_SCALE, Ogre::Vector3 dr=Ogre::Vector3::ZERO, CollisionEventFilter event_filter=EVENT_ALL, int scripthandler=-1)
int loadGroundModelsConfigFile(Ogre::String filename)
void removeCollisionBox(int number)
ground_model_t * getGroundModelByString(const Ogre::String name)
void removeCollisionTri(int number)
void addCollisionMesh(Ogre::String const &srcname, Ogre::String const &meshname, Ogre::Vector3 const &pos, Ogre::Quaternion const &q, Ogre::Vector3 const &scale, ground_model_t *gm=0, std::vector< int > *collTris=0)
generate collision tris from existing mesh resource
@ CONSOLE_MSGTYPE_TERRN
Parsing/spawn/simulation messages for terrain.
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
const TerrainPtr & GetTerrain()
void PushMessage(Message m)
Doesn't guarantee order! Use ChainMessage() if order matters.
ActorManager * GetActorManager()
void AdjustParticleSystemTimeFactor(Ogre::ParticleSystem *psys, GfxActor *gfx_actor=nullptr)
Ogre::SceneManager * GetSceneManager()
std::shared_ptr< ODefDocument > Finalize()
Passes ownership.
void ProcessOgreStream(Ogre::DataStream *stream)
void addObject(ProceduralObjectPtr po)
Generates road mesh and adds to internal list.
ScriptUnitID_t loadScript(Ogre::String filename, ScriptCategory category=ScriptCategory::TERRAIN, ActorPtr associatedActor=nullptr, int32_t associatedNetUid=-1, std::string buffer="")
Loads a script.
void setPosition(Ogre::Vector3 pos)
static const int ACTOR_ID_TERRAIN_OBJECT
SoundScriptInstancePtr createInstance(Ogre::String templatename, int actor_id, int soundLinkType=SL_DEFAULT, int soundLinkItemId=-1)
Wrapper for classic c-string (local buffer) Refresher: strlen() excludes '\0' terminator; strncat() A...
const char * ToCStr() const
TObjDocumentPtr Finalize()
Passes ownership.
static Ogre::Quaternion CalcRotation(Ogre::Vector3 const &rot, bool rot_yxz)
void ProcessOgreStream(Ogre::DataStream *stream)
void ClearSelectedObject()
TerrainEditorObjectID_t GetSelectedObjectID() const
Represents an instance of static terrain object (.ODEF file format)
Ogre::Vector3 getMaxTerrainSize()
std::string getTerrainFileResourceGroup()
TerrainObjectManager * getObjectManager()
TerrainGeometryManager * getGeometryManager()
float getHeightAt(float x, float z)
float getPagedDetailFactor() const
CacheEntryPtr getCacheEntry()
Collisions * GetCollisions()
TerrainEditor * GetTerrainEditor()
Terrn2DocumentPtr GetDef()
Ogre::SceneNode * getGroupingSceneNode()
RoR::ODefDocument * FetchODef(std::string const &odef_name)
bool UpdateTerrainObjects(float dt)
TerrainObjectManager(Terrain *terrainManager)
void UpdateParticleEffectObjects()
bool LoadTerrainObject(const Ogre::String &name, const Ogre::Vector3 &pos, const Ogre::Vector3 &rot, const Ogre::String &instancename, const Ogre::String &type, float rendering_distance=0, bool enable_collisions=true, int scripthandler=-1, bool uniquifyMaterial=false)
TerrainEditorObjectID_t FindEditorObjectByInstanceName(std::string const &instance_name)
Returns offset to m_editor_objects or -1 if not found.
void ProcessODefCollisionBoxes(TerrainEditorObjectPtr obj, ODefDocument *odef, const TerrainEditorObjectPtr ¶ms, bool race_event)
std::vector< TObjDocumentPtr > m_tobj_cache
void ProcessTree(float yawfrom, float yawto, float scalefrom, float scaleto, char *ColorMap, char *DensityMap, char *treemesh, char *treeCollmesh, float gridspacing, float highdens, int minDist, int maxDist, int mapsizex, int mapsizez, Ogre::SceneNode *pagedGroupingNode)
std::vector< MeshObject * > m_mesh_objects
int m_tobj_cache_active_id
void UpdateAnimatedObjects(float dt)
std::vector< Forests::PagedGeometry * > m_paged_geometry
Ogre::SceneNode * m_terrn2_grouping_node
For a readable scene graph (via inspector script)
bool m_has_predefined_actors
void LoadTObjFile(Ogre::String filename)
std::unordered_map< std::string, std::shared_ptr< RoR::ODefDocument > > m_odef_cache
ProceduralManagerPtr m_procedural_manager
bool GetEditorObjectFlagRotYXZ(TerrainEditorObjectPtr const &object)
SurveyMapEntityVec m_map_entities
TerrainEditorObjectPtrVec m_editor_objects
void LoadPredefinedActors()
std::vector< ParticleEffectObject > m_particle_effect_objects
void moveObjectVisuals(const Ogre::String &instancename, const Ogre::Vector3 &pos)
Ogre::SceneNode * m_tobj_grouping_node
For even more readable scene graph (via inspector script)
bool LoadTerrainScript(const Ogre::String &filename)
std::vector< AnimatedObject > m_animated_objects
void SpawnSinglePredefinedActor(TerrainEditorObjectPtr const &object)
void destroyObject(const Ogre::String &instancename)
Ogre::SceneNode * m_angelscript_grouping_node
For even more readable scene graph (via inspector script)
void ProcessGrass(float SwaySpeed, float SwayLength, float SwayDistribution, float Density, float minx, float miny, float minH, float maxx, float maxy, float maxH, char *grassmat, char *colorMapFilename, char *densityMapFilename, Forests::FadeTechnique fadetech, Forests::GrassTechnique techn, int range, int mapsizex, int mapsizez, Ogre::SceneNode *pagedGroupingNode)
LocalizerVec m_localizers
void ProcessPredefinedActor(int tobj_cache_id, const std::string &name, const Ogre::Vector3 position, const Ogre::Vector3 rotation, const TObjSpecialObject type)
@ MSG_SIM_SPAWN_ACTOR_REQUESTED
Payload = RoR::ActorSpawnRequest* (owner)
@ MSG_SIM_DELETE_ACTOR_REQUESTED
Payload = RoR::ActorPtr* (owner)
@ MAPFILTER_BILINEAR
Use bilinear filtering - slower, but will appear less blocky.
GrassTechnique
A technique used to render grass.
Ogre::TRect< Ogre::Real > TBounds
Define TBounds as a TRect using Real numeric units.
FadeTechnique
A technique used to fade grass into the distance.
@ CHANNEL_COLOR
Use the image's full RGB color information.
CameraManager * GetCameraManager()
SoundScriptManager * GetSoundScriptManager()
GameContext * GetGameContext()
CVar * diag_terrn_log_roads
CVar * gfx_vegetation_mode
ScriptEngine * GetScriptEngine()
std::shared_ptr< TObjDocument > TObjDocumentPtr
void HandleGenericException(const std::string &from, BitMask_t flags)
int TerrainEditorObjectID_t
Offset into RoR::TerrainObjectManager::m_editor_objects, use RoR::TERRAINEDITOROBJECTID_INVALID as em...
int ScriptUnitID_t
Unique sequentially generated ID of a loaded and running scriptin session. Use ScriptEngine::getScrip...
static const ActorInstanceID_t ACTORINSTANCEID_INVALID
RefCountingObjectPtr< Actor > ActorPtr
static const ScriptUnitID_t SCRIPTUNITID_INVALID
@ TRUCK2
Free position (not auto-adjusted to fit terrain or water surface)
@ HANDLEGENERICEXCEPTION_CONSOLE
static const TerrainEditorObjectID_t TERRAINEDITOROBJECTID_INVALID
bool asr_terrn_machine
This is a fixed machinery.
Ogre::Vector3 asr_position
ActorInstanceID_t asr_instance_id
Optional; see ActorManager::GetActorNextInstanceID();.
std::string asr_filename
Can be in "Bundle-qualified" format, i.e. "mybundle.zip:myactor.truck".
Ogre::Quaternion asr_rotation
@ TERRN_DEF
Preloaded with terrain.
bool asr_free_position
Disables the automatic spawn position adjustment.
Ogre::Quaternion rotation
Unified game event system - all requests and state changes are reported using a message.
std::list< ODefAnimation > animations
std::list< ODefParticleSys > particle_systems
std::list< ODefCollisionMesh > collision_meshes
struct RoR::ODefDocument::ODefDocumentHeader header
std::list< ODefTexPrint > texture_prints
Section 'drawTextOnMeshTexture'.
std::string mat_name
Section 'setMeshMaterial'.
std::list< std::string > sounds
std::list< ODefPointLight > point_lights
std::list< std::string > groundmodel_files
std::vector< LocalizerType > localizers
std::list< ODefSpotlight > spotlights
std::list< ODefCollisionBox > collision_boxes
std::string mat_name_generate
Section 'generateMaterialShaders'.
Unified 'grass' and 'grass2'.
Ogre::AnimationState * anim
Ogre::ParticleSystem * psys