-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AngelScript: procedural road bindings + docs.
CODECHANGES: * new file ProceduralRoadAngelscript.cpp - binds procedural_point, ProceduralRoadClass, ProceduralObjectClass, ProceduralManagerClass * ProceduralRoad.h/cpp - added strong enums RoadType and TextureFit - extracted from class ProceduralRoad * TerrainAngelscript.cpp - added getter for procedural manager. * TObjFileFormat: accomodated new pointer type.
- Loading branch information
Showing
17 changed files
with
533 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
namespace Script2Game { | ||
|
||
/** \addtogroup ScriptSideAPIs | ||
* @{ | ||
*/ | ||
|
||
/** \addtogroup Script2Game | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* @brief Binding of RoR::ProceduralPoint; | ||
*/ | ||
*/ | ||
struct procedural_point | ||
{ | ||
public: | ||
vector3 position; | ||
quaternion rotation; | ||
float width; | ||
float border_width; | ||
float border_height; | ||
RoadType type; | ||
int pillar_type; | ||
} | ||
|
||
/** | ||
* @brief Binding of RoR::ProceduralObject; a spline for generating dynamic roads. | ||
* @note Obtain the object using `game.getTerrain().getProceduralManager()`. | ||
*/ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.