Merge pull request #65 from n00b87/fix_shadows

Fixed Shadow Rendering
This commit is contained in:
Rodney Cunningham
2025-09-29 02:14:21 -05:00
committed by GitHub
39 changed files with 1256 additions and 407 deletions

View File

@@ -9,6 +9,38 @@
<body>
<p><h2>function GetAntiAliasMode( ) </h2></p>
<p>
Returns the anti-alias mode for draw image commands
</p>
<p>
Possible modes
</p>
<ul>
<li>
AA_MODE_OFF
</li>
<li>
AA_MODE_SIMPLE
</li>
<li>
AA_MODE_QUALITY
</li>
<li>
AA_MODE_LINE_SMOOTH
</li>
<li>
AA_MODE_POINT_SMOOTH
</li>
<li>
AA_MODE_FULL_BASIC
</li>
<li>
AA_MODE_ALPHA_TO_COVERAGE
</li>
</ul>
<br><p>Related:
<a href="setantialiasmode.html">SetAntiAliasMode</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>GetSpriteCanvasAntiAliasMode [RCBasic Doc] </title>
</head>
<body>
<p><h2>function GetSpriteCanvasAntiAliasMode( c_num ) </h2></p>
<p>
Returns the anti-alias mode for a sprite canvas
</p>
<p>
Possible modes
</p>
<ul>
<li>
AA_MODE_OFF
</li>
<li>
AA_MODE_SIMPLE
</li>
<li>
AA_MODE_QUALITY
</li>
<li>
AA_MODE_LINE_SMOOTH
</li>
<li>
AA_MODE_POINT_SMOOTH
</li>
<li>
AA_MODE_FULL_BASIC
</li>
<li>
AA_MODE_ALPHA_TO_COVERAGE
</li>
</ul>
<br><p>Related:
<a href="setspritecanvasantialiasmode.html">SetSpriteCanvasAntiAliasMode</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>GetSpriteCanvasBilinearFilter [RCBasic Doc] </title>
</head>
<body>
<p><h2>function GetSpriteCanvasBilinearFilter( c_num ) </h2></p>
<p>
Returns the bi-linear filter flag for the sprite canvas
</p>
<br><p>Related:
<a href="setspritecanvasbilinearfilter.html">SetSpriteCanvasBilinearFilter</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>GetSpriteCanvasBlendMode [RCBasic Doc] </title>
</head>
<body>
<p><h2>function GetSpriteCanvasBlendMode( c_num ) </h2></p>
<p>
Returns the blend mode used to render sprites on the sprite canvas
</p>
<p>
Possible Blend Modes
</p>
<ul>
<li>
BLEND_MODE_NONE
</li>
<li>
BLEND_MODE_ADD
</li>
<li>
BLEND_MODE_SUBTRACT
</li>
<li>
BLEND_MODE_REVSUBTRACT
</li>
<li>
BLEND_MODE_MIN
</li>
<li>
BLEND_MODE_MAX
</li>
<li>
BLEND_MODE_MIN_FACTOR
</li>
<li>
BLEND_MODE_MAX_FACTOR
</li>
<li>
BLEND_MODE_MIN_ALPHA
</li>
<li>
BLEND_MODE_MAX_ALPHA
</li>
</ul>
<br><p>Related:
<a href="setspritecanvasblendmode.html">SetSpriteCanvasBlendMode</a>
<a href="setblendmode.html">SetBlendMode</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>GetSpriteCanvasPhysics [RCBasic Doc] </title>
</head>
<body>
<p><h2>function GetSpriteCanvasPhysics( c_num ) </h2></p>
<p>
Returns the physics stage of a sprite canvas
</p>
<p>
Return values can be true or false
</p>
<br><p>Related:
<a href="setcanvasphysics2d.html">SetCanvasPhysics2D</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>GetSpriteCanvasRenderPriority [RCBasic Doc] </title>
</head>
<body>
<p><h2>sub GetSpriteCanvasRenderPriority( c_num, ByRef priority, ByRef order ) </h2></p>
<p>
Gets the order sprites are rendered on a sprite canvas.
</p>
<p>
Possible priority values
</p>
<ul>
<li>
SPRITE_PRIORITY_NONE - Sprites are rendered in the order they are added
</li>
<li>
SPRITE_PRIORITY_LEAST_X - Sprites are rendered based on the X position
</li>
<li>
SPRITE_PRIORITY_GREATEST_X - Sprites are rendered based on the X position plus the width
<ul>
<li>
NOTE: Width is adjusted by Scale when calculating the position
</li>
</ul>
</li>
<li>
SPRITE_PRIORITY_LEAST_Y - Sprites are rendered based on the Y position
</li>
<li>
SPRITE_PRIORITY_GREATEST_Y - Sprites are rendered based on the Y position plus the height
<ul>
<li>
NOTE: Height is adjusted by Scale when calculating the position
</li>
</ul>
</li>
</ul>
<p>
<br>
</p>
<p>
Possible order values
</p>
<ul>
<li>
SPRITE_ORDER_ASCENDING - Sprites are ordered from lowest in priority to highest when rendered
</li>
<li>
SPRITE_ORDER_DESCENDING - Sprites are ordered from highest in priority to lowest when rendered
</li>
</ul>
<br><p>Related:
<a href="setspritecanvasrenderpriority.html">SetSpriteCanvasRenderPriority</a>
</p>
<p>
</body>
</html>

View File

@@ -1683,6 +1683,14 @@ ul, #myUL {
<li><a href="recalculatemeshboundingbox.html" target="main">ReCalculateMeshBoundingBox</a></li>
<li><a href="makeplanartexturemap.html" target="main">MakePlanarTextureMap</a></li>
<li><a href="recalculatemeshnormals.html" target="main">ReCalculateMeshNormals</a></li>
<li><a href="getmeshpolygoncount.html" target="main">GetMeshPolygonCount</a></li>
<li><a href="flipmeshsurfaces.html" target="main">FlipMeshSurfaces</a></li>
</ul>
</li>

View File

@@ -9,6 +9,38 @@
<body>
<p><h2>sub SetAntiAliasMode( aa_mode ) </h2></p>
<p>
Sets the anti-alias mode for draw image commands
</p>
<p>
Possible modes
</p>
<ul>
<li>
AA_MODE_OFF
</li>
<li>
AA_MODE_SIMPLE
</li>
<li>
AA_MODE_QUALITY
</li>
<li>
AA_MODE_LINE_SMOOTH
</li>
<li>
AA_MODE_POINT_SMOOTH
</li>
<li>
AA_MODE_FULL_BASIC
</li>
<li>
AA_MODE_ALPHA_TO_COVERAGE
</li>
</ul>
<br><p>Related:
<a href="getantialiasmode.html">GetAntiAliasMode</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>SetSpriteCanvasAntiAliasMode [RCBasic Doc] </title>
</head>
<body>
<p><h2>sub SetSpriteCanvasAntiAliasMode( c_num, aa_mode ) </h2></p>
<p>
Sets the anti-alias mode for a sprite canvas
</p>
<p>
Possible modes
</p>
<ul>
<li>
AA_MODE_OFF
</li>
<li>
AA_MODE_SIMPLE
</li>
<li>
AA_MODE_QUALITY
</li>
<li>
AA_MODE_LINE_SMOOTH
</li>
<li>
AA_MODE_POINT_SMOOTH
</li>
<li>
AA_MODE_FULL_BASIC
</li>
<li>
AA_MODE_ALPHA_TO_COVERAGE
</li>
</ul>
<br><p>Related:
<a href="getspritecanvasantialiasmode.html">GetSpriteCanvasAntiAliasMode</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>SetSpriteCanvasBilinearFilter [RCBasic Doc] </title>
</head>
<body>
<p><h2>sub SetSpriteCanvasBilinearFilter( c_num, flag ) </h2></p>
<p>
Enables or disables bi-linear filter for the sprite canvas
</p>
<br><p>Related:
<a href="getspritecanvasbilinearfilter.html">GetSpriteCanvasBilinearFilter</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>SetSpriteCanvasBlendMode [RCBasic Doc] </title>
</head>
<body>
<p><h2>sub SetSpriteCanvasBlendMode( c_num, blend_mode ) </h2></p>
<p>
Sets the blend mode used to render sprites on the given sprite canvas
</p>
<p>
Possible Blend Modes
</p>
<ul>
<li>
BLEND_MODE_NONE
</li>
<li>
BLEND_MODE_ADD
</li>
<li>
BLEND_MODE_SUBTRACT
</li>
<li>
BLEND_MODE_REVSUBTRACT
</li>
<li>
BLEND_MODE_MIN
</li>
<li>
BLEND_MODE_MAX
</li>
<li>
BLEND_MODE_MIN_FACTOR
</li>
<li>
BLEND_MODE_MAX_FACTOR
</li>
<li>
BLEND_MODE_MIN_ALPHA
</li>
<li>
BLEND_MODE_MAX_ALPHA
</li>
</ul>
<br><p>Related:
<a href="setcanvasblendmode.html">SetCanvasBlendMode</a>
<a href="getspritecanvasblendmode.html">GetSpriteCanvasBlendMode</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<title>SetSpriteCanvasRenderPriority [RCBasic Doc] </title>
</head>
<body>
<p><h2>function SetSpriteCanvasRenderPriority( c_num, priority, order ) </h2></p>
<p>
Sets the order sprites are rendered on a sprite canvas.
</p>
<p>
Returns False if canvas is not a valid canvas
</p>
<p>
Possible priority values
</p>
<ul>
<li>
SPRITE_PRIORITY_NONE - Sprites are rendered in the order they are added
</li>
<li>
SPRITE_PRIORITY_LEAST_X - Sprites are rendered based on the X position
</li>
<li>
SPRITE_PRIORITY_GREATEST_X - Sprites are rendered based on the X position plus the width
<ul>
<li>
NOTE: Width is adjusted by Scale when calculating the position
</li>
</ul>
</li>
<li>
SPRITE_PRIORITY_LEAST_Y - Sprites are rendered based on the Y position
</li>
<li>
SPRITE_PRIORITY_GREATEST_Y - Sprites are rendered based on the Y position plus the height
<ul>
<li>
NOTE: Height is adjusted by Scale when calculating the position
</li>
</ul>
</li>
</ul>
<p>
<br>
</p>
<p>
Possible order values
</p>
<ul>
<li>
SPRITE_ORDER_ASCENDING - Sprites are ordered from lowest in priority to highest when rendered
</li>
<li>
SPRITE_ORDER_DESCENDING - Sprites are ordered from highest in priority to lowest when rendered
</li>
</ul>
<br><p>Related:
<a href="getspritecanvasrenderpriority.html">GetSpriteCanvasRenderPriority</a>
</p>
<p>
</body>
</html>

View File

@@ -0,0 +1,4 @@
#title FlipMeshSurfaces [RCBasic Doc]
#header Sub FlipMeshSurfaces( mesh )
Changes the facing direction of triangles in a mesh

View File

@@ -1,4 +1,17 @@
#title GetAntiAliasMode [RCBasic Doc]
#header function GetAntiAliasMode( )
Returns the anti-alias mode for draw image commands
Possible modes
#list
#li AA_MODE_OFF
#li AA_MODE_SIMPLE
#li AA_MODE_QUALITY
#li AA_MODE_LINE_SMOOTH
#li AA_MODE_POINT_SMOOTH
#li AA_MODE_FULL_BASIC
#li AA_MODE_ALPHA_TO_COVERAGE
#/list
#ref SetAntiAliasMode

View File

@@ -0,0 +1,4 @@
#title GetMeshPolygonCount [RCBasic Doc]
#header Function GetMeshPolygonCount( mesh )
Returns the number of polygons in a mesh

View File

@@ -1,4 +1,17 @@
#title GetSpriteCanvasAntiAliasMode [RCBasic Doc]
#header function GetSpriteCanvasAntiAliasMode( c_num )
Returns the anti-alias mode for a sprite canvas
Possible modes
#list
#li AA_MODE_OFF
#li AA_MODE_SIMPLE
#li AA_MODE_QUALITY
#li AA_MODE_LINE_SMOOTH
#li AA_MODE_POINT_SMOOTH
#li AA_MODE_FULL_BASIC
#li AA_MODE_ALPHA_TO_COVERAGE
#/list
#ref SetSpriteCanvasAntiAliasMode

View File

@@ -1,4 +1,6 @@
#title GetSpriteCanvasBilinearFilter [RCBasic Doc]
#header function GetSpriteCanvasBilinearFilter( c_num )
Returns the bi-linear filter flag for the sprite canvas
#ref SetSpriteCanvasBilinearFilter

View File

@@ -1,4 +1,20 @@
#title GetSpriteCanvasBlendMode [RCBasic Doc]
#header function GetSpriteCanvasBlendMode( c_num )
Returns the blend mode used to render sprites on the sprite canvas
Possible Blend Modes
#list ul
#li BLEND_MODE_NONE
#li BLEND_MODE_ADD
#li BLEND_MODE_SUBTRACT
#li BLEND_MODE_REVSUBTRACT
#li BLEND_MODE_MIN
#li BLEND_MODE_MAX
#li BLEND_MODE_MIN_FACTOR
#li BLEND_MODE_MAX_FACTOR
#li BLEND_MODE_MIN_ALPHA
#li BLEND_MODE_MAX_ALPHA
#/list
#ref SetSpriteCanvasBlendMode SetBlendMode

View File

@@ -1,4 +1,8 @@
#title GetSpriteCanvasPhysics [RCBasic Doc]
#header function GetSpriteCanvasPhysics( c_num )
Returns the physics stage of a sprite canvas
Return values can be true or false
#ref SetCanvasPhysics2D

View File

@@ -1,4 +1,29 @@
#title GetSpriteCanvasRenderPriority [RCBasic Doc]
#header sub GetSpriteCanvasRenderPriority( c_num, ByRef priority, ByRef order )
Gets the order sprites are rendered on a sprite canvas.
Possible priority values
#list ul
#li SPRITE_PRIORITY_NONE - Sprites are rendered in the order they are added
#li SPRITE_PRIORITY_LEAST_X - Sprites are rendered based on the X position
#li SPRITE_PRIORITY_GREATEST_X - Sprites are rendered based on the X position plus the width
#list ul
#li NOTE: Width is adjusted by Scale when calculating the position
#/list
#li SPRITE_PRIORITY_LEAST_Y - Sprites are rendered based on the Y position
#li SPRITE_PRIORITY_GREATEST_Y - Sprites are rendered based on the Y position plus the height
#list ul
#li NOTE: Height is adjusted by Scale when calculating the position
#/list
#/list
<br>
Possible order values
#list ul
#li SPRITE_ORDER_ASCENDING - Sprites are ordered from lowest in priority to highest when rendered
#li SPRITE_ORDER_DESCENDING - Sprites are ordered from highest in priority to lowest when rendered
#/list
#ref SetSpriteCanvasRenderPriority

View File

@@ -0,0 +1,7 @@
#title MakePlanarTextureMap [RCBasic Doc]
#header Sub MakePlanarTextureMap( mesh, resolution )
Makes a planar texture map for the mesh.
Resolution is a ratio of the world space to texture space
NOTE: Value should be between 0 and 1, a recommended value to start with is 0.001

View File

@@ -0,0 +1,4 @@
#title ReCalculateMeshNormals [RCBasic Doc]
#header Sub ReCalculateMeshNormals( mesh )
Calculates the facing direction of the normals in a mesh

View File

@@ -1,4 +1,17 @@
#title SetAntiAliasMode [RCBasic Doc]
#header sub SetAntiAliasMode( aa_mode )
Sets the anti-alias mode for draw image commands
Possible modes
#list
#li AA_MODE_OFF
#li AA_MODE_SIMPLE
#li AA_MODE_QUALITY
#li AA_MODE_LINE_SMOOTH
#li AA_MODE_POINT_SMOOTH
#li AA_MODE_FULL_BASIC
#li AA_MODE_ALPHA_TO_COVERAGE
#/list
#ref GetAntiAliasMode

View File

@@ -1,4 +1,17 @@
#title SetSpriteCanvasAntiAliasMode [RCBasic Doc]
#header sub SetSpriteCanvasAntiAliasMode( c_num, aa_mode )
Sets the anti-alias mode for a sprite canvas
Possible modes
#list
#li AA_MODE_OFF
#li AA_MODE_SIMPLE
#li AA_MODE_QUALITY
#li AA_MODE_LINE_SMOOTH
#li AA_MODE_POINT_SMOOTH
#li AA_MODE_FULL_BASIC
#li AA_MODE_ALPHA_TO_COVERAGE
#/list
#ref GetSpriteCanvasAntiAliasMode

View File

@@ -1,4 +1,6 @@
#title SetSpriteCanvasBilinearFilter [RCBasic Doc]
#header sub SetSpriteCanvasBilinearFilter( c_num, flag )
Enables or disables bi-linear filter for the sprite canvas
#ref GetSpriteCanvasBilinearFilter

View File

@@ -1,4 +1,22 @@
#title SetSpriteCanvasBlendMode [RCBasic Doc]
#header sub SetSpriteCanvasBlendMode( c_num, blend_mode )
Sets the blend mode used to render sprites on the given sprite canvas
Possible Blend Modes
#list ul
#li BLEND_MODE_NONE
#li BLEND_MODE_ADD
#li BLEND_MODE_SUBTRACT
#li BLEND_MODE_REVSUBTRACT
#li BLEND_MODE_MIN
#li BLEND_MODE_MAX
#li BLEND_MODE_MIN_FACTOR
#li BLEND_MODE_MAX_FACTOR
#li BLEND_MODE_MIN_ALPHA
#li BLEND_MODE_MAX_ALPHA
#/list
#ref SetCanvasBlendMode GetSpriteCanvasBlendMode

View File

@@ -1,4 +1,31 @@
#title SetSpriteCanvasRenderPriority [RCBasic Doc]
#header function SetSpriteCanvasRenderPriority( c_num, priority, order )
Sets the order sprites are rendered on a sprite canvas.
Returns False if canvas is not a valid canvas
Possible priority values
#list ul
#li SPRITE_PRIORITY_NONE - Sprites are rendered in the order they are added
#li SPRITE_PRIORITY_LEAST_X - Sprites are rendered based on the X position
#li SPRITE_PRIORITY_GREATEST_X - Sprites are rendered based on the X position plus the width
#list ul
#li NOTE: Width is adjusted by Scale when calculating the position
#/list
#li SPRITE_PRIORITY_LEAST_Y - Sprites are rendered based on the Y position
#li SPRITE_PRIORITY_GREATEST_Y - Sprites are rendered based on the Y position plus the height
#list ul
#li NOTE: Height is adjusted by Scale when calculating the position
#/list
#/list
<br>
Possible order values
#list ul
#li SPRITE_ORDER_ASCENDING - Sprites are ordered from lowest in priority to highest when rendered
#li SPRITE_ORDER_DESCENDING - Sprites are ordered from highest in priority to lowest when rendered
#/list
#ref GetSpriteCanvasRenderPriority

View File

@@ -687,6 +687,10 @@ rc_deleteAN8( DELETEAN8_AN8_PROJECT )
rc_setMeshBoundingBox( SETMESHBOUNDINGBOX_MESH, SETMESHBOUNDINGBOX_MIN_X, SETMESHBOUNDINGBOX_MIN_Y, SETMESHBOUNDINGBOX_MIN_Z, SETMESHBOUNDINGBOX_MAX_X, SETMESHBOUNDINGBOX_MAX_Y, SETMESHBOUNDINGBOX_MAX_Z )
rc_getMeshBoundingBox( GETMESHBOUNDINGBOX_MESH, &GETMESHBOUNDINGBOX_MIN_X, &GETMESHBOUNDINGBOX_MIN_Y, &GETMESHBOUNDINGBOX_MIN_Z, &GETMESHBOUNDINGBOX_MAX_X, &GETMESHBOUNDINGBOX_MAX_Y, &GETMESHBOUNDINGBOX_MAX_Z )
rc_reCalculateMeshBoundingBox( RECALCULATEMESHBOUNDINGBOX_MESH )
rc_makePlanarTextureMap( MAKEPLANARTEXTUREMAP_MESH, MAKEPLANARTEXTUREMAP_RESOLUTION )
rc_reCalculateMeshNormals( RECALCULATEMESHNORMALS_MESH )
rc_getMeshPolygonCount( GETMESHPOLYGONCOUNT_MESH )
rc_flipMeshSurfaces( FLIPMESHSURFACES_MESH )
rc_createAnimatedActor( CREATEANIMATEDACTOR_MESH )
rc_createOctreeActor( CREATEOCTREEACTOR_MESH )
rc_createCubeActor( CREATECUBEACTOR_CUBE_SIZE )

View File

@@ -15,3 +15,7 @@ Sub DeleteAN8( an8_project )
Sub SetMeshBoundingBox( mesh, min_x, min_y, min_z, max_x, max_y, max_z )
Sub GetMeshBoundingBox( mesh, ByRef min_x, ByRef min_y, ByRef min_z, ByRef max_x, ByRef max_y, ByRef max_z )
Sub ReCalculateMeshBoundingBox( mesh )
Sub MakePlanarTextureMap( mesh, resolution )
Sub ReCalculateMeshNormals( mesh )
Function GetMeshPolygonCount( mesh )
Sub FlipMeshSurfaces( mesh )

View File

@@ -959,7 +959,7 @@ int main(int argc, char * argv[])
if(rc_filename.compare("--version")==0)
{
cout << "RCBASIC Compiler v4.5" << endl;
cout << "RCBASIC Compiler v4.6" << endl;
return 0;
}

View File

@@ -2081,6 +2081,15 @@ void init_embedded_functions()
add_embedded_arg("max_z", ID_TYPE_BYREF_NUM);
embed_function("ReCalculateMeshBoundingBox", ID_TYPE_SUB);
add_embedded_arg("mesh", ID_TYPE_NUM);
embed_function("MakePlanarTextureMap", ID_TYPE_SUB);
add_embedded_arg("mesh", ID_TYPE_NUM);
add_embedded_arg("resolution", ID_TYPE_NUM);
embed_function("ReCalculateMeshNormals", ID_TYPE_SUB);
add_embedded_arg("mesh", ID_TYPE_NUM);
embed_function("GetMeshPolygonCount", ID_TYPE_FN_NUM);
add_embedded_arg("mesh", ID_TYPE_NUM);
embed_function("FlipMeshSurfaces", ID_TYPE_SUB);
add_embedded_arg("mesh", ID_TYPE_NUM);
embed_function("CreateAnimatedActor", ID_TYPE_FN_NUM);
add_embedded_arg("mesh", ID_TYPE_NUM);
embed_function("CreateOctreeActor", ID_TYPE_FN_NUM);

Binary file not shown.

View File

@@ -4398,7 +4398,7 @@ int main(int argc, char * argv[])
if(rc_filename.compare("--version")==0)
{
cout << "RCBASIC Runtime v4.5" << endl;
cout << "RCBASIC Runtime v4.6" << endl;
return 0;
}
@@ -4452,7 +4452,7 @@ int main(int argc, char * argv[])
//ogles2 test
#ifdef RC_TESTING
rc_intern_dirChange("/home/n00b/Projects/SerenityEngine/Untitled_Project/test");
rc_intern_dirChange("/home/n00b/GameDev/Irrlicht Demo");
//rc_intern_dirChange("");
rc_filename = "main.cbc";

View File

@@ -83,6 +83,11 @@ void rc_setActorCollisionShape(int actor_id, int shape_type, double mass)
irr::scene::IAnimatedMeshSceneNode* node = (irr::scene::IAnimatedMeshSceneNode*)rc_actor[actor_id].mesh_node;
shape = new ICapsuleShape(node, mass, false);
}
else if(rc_actor[actor_id].node_type == RC_NODE_TYPE_STMESH)
{
irr::scene::IMeshSceneNode* node = (irr::scene::IMeshSceneNode*)rc_actor[actor_id].mesh_node;
shape = new ICapsuleShape(node, mass, false);
}
else if(rc_actor[actor_id].node_type == RC_NODE_TYPE_OTMESH)
{
irr::scene::IOctreeSceneNode* node = (irr::scene::IOctreeSceneNode*)rc_actor[actor_id].mesh_node;
@@ -93,6 +98,10 @@ void rc_setActorCollisionShape(int actor_id, int shape_type, double mass)
irr::scene::ITerrainSceneNode* node = (irr::scene::ITerrainSceneNode*)rc_actor[actor_id].mesh_node;
shape = new ICapsuleShape(node, mass, false);
}
else
{
shape = new ICapsuleShape(rc_actor[actor_id].mesh_node, mass, false);
}
rc_actor[actor_id].physics.rigid_body = rc_physics3D.world->addRigidBody(shape);
@@ -121,6 +130,11 @@ void rc_setActorCollisionShape(int actor_id, int shape_type, double mass)
irr::scene::IAnimatedMeshSceneNode* node = (irr::scene::IAnimatedMeshSceneNode*)rc_actor[actor_id].mesh_node;
shape = new IBvhTriangleMeshShape(rc_actor[actor_id].mesh_node, node->getMesh(), mass);
}
else if(rc_actor[actor_id].node_type == RC_NODE_TYPE_STMESH)
{
irr::scene::IMeshSceneNode* node = (irr::scene::IMeshSceneNode*)rc_actor[actor_id].mesh_node;
shape = new IBvhTriangleMeshShape(rc_actor[actor_id].mesh_node, node->getMesh(), mass);
}
else if(rc_actor[actor_id].node_type == RC_NODE_TYPE_OTMESH)
{
irr::scene::IOctreeSceneNode* node = (irr::scene::IOctreeSceneNode*)rc_actor[actor_id].mesh_node;
@@ -150,6 +164,11 @@ void rc_setActorCollisionShape(int actor_id, int shape_type, double mass)
irr::scene::IAnimatedMeshSceneNode* node = (irr::scene::IAnimatedMeshSceneNode*)rc_actor[actor_id].mesh_node;
shape = new IConvexHullShape(rc_actor[actor_id].mesh_node, node->getMesh(), mass);
}
else if(rc_actor[actor_id].node_type == RC_NODE_TYPE_STMESH)
{
irr::scene::IMeshSceneNode* node = (irr::scene::IMeshSceneNode*)rc_actor[actor_id].mesh_node;
shape = new IConvexHullShape(rc_actor[actor_id].mesh_node, node->getMesh(), mass);
}
else if(rc_actor[actor_id].node_type == RC_NODE_TYPE_OTMESH)
{
irr::scene::IOctreeSceneNode* node = (irr::scene::IOctreeSceneNode*)rc_actor[actor_id].mesh_node;
@@ -524,7 +543,7 @@ int rc_createCubeActor(double cube_size)
int actor_id = -1;
irr::scene::IMeshSceneNode* node = SceneManager->addCubeSceneNode(cube_size);
rc_scene_node actor;
actor.node_type = RC_NODE_TYPE_MESH;
actor.node_type = RC_NODE_TYPE_STMESH;
actor.mesh_node = node;
#if defined(__ANDROID__)
@@ -574,7 +593,7 @@ int rc_createSphereActor(double radius)
int actor_id = -1;
irr::scene::IMeshSceneNode* node = SceneManager->addSphereSceneNode(radius);
rc_scene_node actor;
actor.node_type = RC_NODE_TYPE_MESH;
actor.node_type = RC_NODE_TYPE_STMESH;
actor.mesh_node = node;
#if defined(__ANDROID__)
@@ -1106,14 +1125,35 @@ void rc_addActorShadow(int actor)
switch(rc_actor[actor].node_type)
{
case RC_NODE_TYPE_TERRAIN:
case RC_NODE_TYPE_OTMESH:
{
irr::scene::IOctreeSceneNode* node = (irr::scene::IOctreeSceneNode*)rc_actor[actor].mesh_node;
if(!rc_actor[actor].shadow)
{
rc_actor[actor].shadow = node->addShadowVolumeSceneNode();
}
}
break;
case RC_NODE_TYPE_STMESH:
case RC_NODE_TYPE_MESH:
{
irr::scene::IMeshSceneNode* node = (irr::scene::IMeshSceneNode*)rc_actor[actor].mesh_node;
if(!rc_actor[actor].shadow)
rc_actor[actor].shadow = node->addShadowVolumeSceneNode();
break;
{
rc_actor[actor].shadow = node->addShadowVolumeSceneNode();
}
}
break;
case RC_NODE_TYPE_MESH:
{
irr::scene::IAnimatedMeshSceneNode* node = (irr::scene::IAnimatedMeshSceneNode*)rc_actor[actor].mesh_node;
if(!rc_actor[actor].shadow)
{
rc_actor[actor].shadow = node->addShadowVolumeSceneNode();
}
}
break;
}
}
@@ -1127,7 +1167,6 @@ void rc_removeActorShadow(int actor)
switch(rc_actor[actor].node_type)
{
case RC_NODE_TYPE_TERRAIN:
case RC_NODE_TYPE_OTMESH:
case RC_NODE_TYPE_STMESH:
case RC_NODE_TYPE_MESH:

File diff suppressed because it is too large Load Diff

View File

@@ -2093,6 +2093,18 @@ case FN_GetMeshBoundingBox: //Sub Procedure
case FN_ReCalculateMeshBoundingBox: //Sub Procedure
rc_reCalculateMeshBoundingBox( RECALCULATEMESHBOUNDINGBOX_MESH );
break;
case FN_MakePlanarTextureMap: //Sub Procedure
rc_makePlanarTextureMap( MAKEPLANARTEXTUREMAP_MESH, MAKEPLANARTEXTUREMAP_RESOLUTION );
break;
case FN_ReCalculateMeshNormals: //Sub Procedure
rc_reCalculateMeshNormals( RECALCULATEMESHNORMALS_MESH );
break;
case FN_GetMeshPolygonCount: //Number Function
rc_push_num(rc_getMeshPolygonCount( GETMESHPOLYGONCOUNT_MESH ));
break;
case FN_FlipMeshSurfaces: //Sub Procedure
rc_flipMeshSurfaces( FLIPMESHSURFACES_MESH );
break;
case FN_CreateAnimatedActor: //Number Function
rc_push_num(rc_createAnimatedActor( CREATEANIMATEDACTOR_MESH ));
break;

View File

@@ -267,6 +267,93 @@ void setMouseScaling()
}
}
SDL_Window* createWindow(irr::SIrrlichtCreationParameters CreationParams, std::string title, int x, int y, int Width, int Height, uint32_t SDL_Flags, irr::u8 AntiAlias, bool stencil_buffer, bool vsync)
{
SDL_Window* window = NULL;
if (CreationParams.DriverType == irr::video::EDT_OPENGL || CreationParams.DriverType == irr::video::EDT_OGLES2 || CreationParams.DriverType == irr::video::EDT_WEBGL1)
{
if(stencil_buffer)
{
//std::cout << "Set Stencil Size" << std::endl;
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
}
if(CreationParams.DriverType == irr::video::EDT_OPENGL)
{
SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
}
if(CreationParams.DriverType == irr::video::EDT_OGLES2 || CreationParams.DriverType == irr::video::EDT_WEBGL1)
{
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
}
if (CreationParams.Bits==16)
{
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 4 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 4 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 4 );
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, CreationParams.WithAlphaChannel?1:0 );
}
else
{
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, CreationParams.WithAlphaChannel ? 8 : 0 );
}
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, CreationParams.ZBufferBits);
if (CreationParams.Doublebuffer)
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if (CreationParams.Stereobuffer)
SDL_GL_SetAttribute( SDL_GL_STEREO, 1 );
if (CreationParams.AntiAlias>1)
{
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, CreationParams.AntiAlias );
}
if ( !window )
window = SDL_CreateWindow(title.c_str(), x, y, Width, Height, SDL_Flags);
if ( !window && CreationParams.AntiAlias>1)
{
while (--CreationParams.AntiAlias>1)
{
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, CreationParams.AntiAlias );
window = SDL_CreateWindow(title.c_str(), x, y, Width, Height, SDL_Flags);
if (window)
break;
}
if ( !window )
{
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 0 );
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 0 );
window = SDL_CreateWindow(title.c_str(), x, y, Width, Height, SDL_Flags);
if (window)
std::cout << "AntiAliasing disabled due to lack of support!" << std::endl;
}
}
}
else if ( !window )
window = SDL_CreateWindow("", x, y, Width, Height, SDL_Flags);
if ( !window && CreationParams.Doublebuffer)
{
// Try single buffer
if (CreationParams.DriverType == irr::video::EDT_OPENGL || CreationParams.DriverType == irr::video::EDT_OGLES2)
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
//SDL_Flags &= ~SDL_DOUBLEBUF;
window = SDL_CreateWindow(title.c_str(), x, y, Width, Height, SDL_Flags);
}
return window;
}
bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t window_flags, irr::u8 AntiAlias, bool stencil_buffer, bool vsync)
{
if(rc_window)
@@ -291,12 +378,6 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
rc_window_size.Width = w;
rc_window_size.Height = h;
rc_window = SDL_CreateWindow(title.c_str(), x, y, w, h, flags);
//Get the actual size of the window to set the dimensions of the device
if(rc_window)
SDL_GetWindowSize(rc_window, &w, &h);
SIrrlichtCreationParameters irr_creation_params;
irr_creation_params.DeviceType = EIDT_SDL;
#if defined(RC_DRIVER_GLES2)
@@ -304,8 +385,6 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
#else
irr_creation_params.DriverType = video::EDT_OPENGL;
#endif // defined
irr_creation_params.WindowId = rc_window;
irr_creation_params.WindowSize = dimension2d<u32>((u32)w, (u32)h);
irr_creation_params.Bits = 16;
irr_creation_params.Fullscreen = fullscreen;
irr_creation_params.Stencilbuffer = stencil_buffer;
@@ -317,6 +396,17 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
rc_window_setfps = vsync;
rc_window = createWindow(irr_creation_params, title.c_str(), x, y, w, h, flags, AntiAlias, stencil_buffer, vsync);
//Get the actual size of the window to set the dimensions of the device
if(rc_window)
SDL_GetWindowSize(rc_window, &w, &h);
irr_creation_params.WindowId = rc_window;
irr_creation_params.WindowSize = dimension2d<u32>((u32)w, (u32)h);
device = createDeviceEx(irr_creation_params);
if(vsync)
{
SDL_DisplayMode dm;
@@ -325,8 +415,6 @@ bool rc_windowOpenEx(std::string title, int x, int y, int w, int h, uint32_t win
rc_setfps_timer = SDL_GetTicks();
}
device = createDeviceEx(irr_creation_params);
if (!device)
{

View File

@@ -118,6 +118,55 @@ void rc_reCalculateMeshBoundingBox(int mesh_id)
}
}
void rc_reCalculateMeshNormals(int mesh_id)
{
if(mesh_id < 0 || mesh_id >= rc_mesh.size())
return;
if(rc_mesh[mesh_id].mesh)
{
for(int i = 0; i < rc_mesh[mesh_id].mesh->getMeshBufferCount(); i++)
SceneManager->getMeshManipulator()->recalculateNormals(rc_mesh[mesh_id].mesh->getMeshBuffer(i));
}
}
void rc_makePlanarTextureMap(int mesh_id, double resolution)
{
if(mesh_id < 0 || mesh_id >= rc_mesh.size())
return;
if(rc_mesh[mesh_id].mesh)
{
for(int i = 0; i < rc_mesh[mesh_id].mesh->getMeshBufferCount(); i++)
SceneManager->getMeshManipulator()->makePlanarTextureMapping(rc_mesh[mesh_id].mesh->getMeshBuffer(i), resolution);
}
}
int rc_getMeshPolygonCount(int mesh_id)
{
if(mesh_id < 0 || mesh_id >= rc_mesh.size())
return 0;
if(rc_mesh[mesh_id].mesh)
{
if(rc_mesh[mesh_id].mesh_type == RC_MESH_TYPE_ANIMATED)
return SceneManager->getMeshManipulator()->getPolyCount((irr::scene::IAnimatedMesh*)rc_mesh[mesh_id].mesh);
else
return SceneManager->getMeshManipulator()->getPolyCount(rc_mesh[mesh_id].mesh);
}
}
void rc_flipMeshSurfaces(int mesh_id)
{
if(mesh_id < 0 || mesh_id >= rc_mesh.size())
return;
if(rc_mesh[mesh_id].mesh)
{
SceneManager->getMeshManipulator()->flipSurfaces(rc_mesh[mesh_id].mesh);
}
}
int rc_loadAN8(std::string an8_file)

View File

@@ -46,7 +46,7 @@
//FOR TESTING PURPOSES
#ifdef RC_TESTING
#define RC_DRIVER_GLES2
//#define RC_DRIVER_GLES2
#endif // RC_TESTING
#define RC_PI 3.14159265359