Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Procedural road editing using AngelScript #2976

Merged
merged 11 commits into from Dec 3, 2022
37 changes: 37 additions & 0 deletions doc/angelscript/Script2Game/ProceduralManagerClass.h
@@ -0,0 +1,37 @@

namespace Script2Game {

/** \addtogroup ScriptSideAPIs
* @{
*/

/** \addtogroup Script2Game
* @{
*/

/**
* @brief Binding of RoR::ProceduralManager; generates dynamic roads for terrain.
* @note Obtain the object using `game.getTerrain().getProceduralManager()`.
*/
class ProceduralManagerClass
{
public:
/**
* Generates road mesh and adds to internal list
*/
void addObject(ProceduralObjectClass @po);

/**
* Clears road mesh and removes from internal list
*/
void removeObject(ProceduralObjectClass @po);

int getNumObjects();

ProceduralObjectClass@ getObject(int pos);
};

/// @} //addtogroup Script2Game
/// @} //addtogroup ScriptSideAPIs

} //namespace Script2Game
41 changes: 41 additions & 0 deletions doc/angelscript/Script2Game/ProceduralObjectClass.h
@@ -0,0 +1,41 @@

namespace Script2Game {

/** \addtogroup ScriptSideAPIs
* @{
*/

/** \addtogroup Script2Game
* @{
*/

/**
* @brief Binding of RoR::ProceduralObject; a spline for generating dynamic roads.
*/
class ProceduralObjectClass
{
public:
/**
* Name of the road/street this spline represents.
*/
string name;

/**
* Adds point at the end.
*/
void addPoint(procedural_point);

/**
* Adds point before the element at the specified position.
*/
void insertPoint(int pos, procedural_point);
void deletePoint(int pos);
procedural_point getPoint(int pos);
int getNumPoints();
ProceduralRoadClass @getRoad();
};

/// @} //addtogroup Script2Game
/// @} //addtogroup ScriptSideAPIs

} //namespace Script2Game
30 changes: 30 additions & 0 deletions doc/angelscript/Script2Game/ProceduralPointClass.h
@@ -0,0 +1,30 @@

namespace Script2Game {

/** \addtogroup ScriptSideAPIs
* @{
*/

/** \addtogroup Script2Game
* @{
*/

/**
* @brief Binding of RoR::ProceduralPoint;
*/
struct ProceduralPointClass
{
public:
vector3 position;
quaternion rotation;
float width;
float border_width;
float border_height;
RoadType type;
int pillar_type;
};

/// @} //addtogroup Script2Game
/// @} //addtogroup ScriptSideAPIs

} //namespace Script2Game
75 changes: 75 additions & 0 deletions doc/angelscript/Script2Game/ProceduralRoadClass.h
@@ -0,0 +1,75 @@

namespace Script2Game {

/** \addtogroup ScriptSideAPIs
* @{
*/

/** \addtogroup Script2Game
* @{
*/

enum RoadType
{
ROAD_AUTOMATIC,
ROAD_FLAT,
ROAD_LEFT,
ROAD_RIGHT,
ROAD_BOTH,
ROAD_BRIDGE,
ROAD_MONORAIL
};

enum TextureFit
{
TEXFIT_NONE,
TEXFIT_BRICKWALL,
TEXFIT_ROADS1,
TEXFIT_ROADS2,
TEXFIT_ROAD,
TEXFIT_ROADS3,
TEXFIT_ROADS4,
TEXFIT_CONCRETEWALL,
TEXFIT_CONCRETEWALLI,
TEXFIT_CONCRETETOP,
TEXFIT_CONCRETEUNDER
};

/**
* @brief Binding of RoR::ProceduralRoad; a dynamically generated road mesh.
* @note For internal use by ProceduralManagerClass - do not use unless you know what you're doing!
*/
*/
class ProceduralRoadClass
{
public:
/**
* For internal use by ProceduralManagerClass - do not use unless you know what you're doing!
*/
void addBlock(vector3 pos, quaternion rot, RoadType type, float width, float border_width, float border_height, int pillar_type = 1);
/**
* For internal use by ProceduralManagerClass - do not use unless you know what you're doing!
*/
void addQuad(vector3 p1, vector3 p2, vector3 p3, vector3 p4, TextureFit texfit, vector3 pos, vector3 lastpos, float width, bool flip = false);
/**
* For internal use by ProceduralManagerClass - do not use unless you know what you're doing!
*/
void addCollisionQuad(vector3 p1, vector3 p2, vector3 p3, vector3 p4, string const&in gm_name, bool flip = false);
/**
* For internal use by ProceduralManagerClass - do not use unless you know what you're doing!
*/
void createMesh();
/**
* For internal use by ProceduralManagerClass - do not use unless you know what you're doing!
*/
void finish();
/**
* For internal use by ProceduralManagerClass - do not use unless you know what you're doing!
*/
void setCollisionEnabled(bool v);
};

/// @} //addtogroup Script2Game
/// @} //addtogroup ScriptSideAPIs

} //namespace Script2Game
2 changes: 2 additions & 0 deletions doc/angelscript/Script2Game/TerrainClass.h
Expand Up @@ -40,6 +40,8 @@ class TerrainClass
* @return Player spawn position when entering game.
*/
vector3 getSpawnPos();

ProceduralManagerClass @getProceduralManager();
};

/// @} //addtogroup Script2Game
Expand Down