New object types for all types.
This commit is contained in:
329
API.md
329
API.md
@@ -3515,12 +3515,9 @@ Draw a source image within a destination image (Tint applied to source)
|
||||
|
||||
---
|
||||
|
||||
> success = RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )
|
||||
> RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )
|
||||
|
||||
Draw text ( Custom sprite font ) within an image ( Destination )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
Draw text (Custom sprite font) within an image (Destination)
|
||||
|
||||
---
|
||||
|
||||
@@ -3868,7 +3865,7 @@ Load font from file into GPU memory (VRAM)
|
||||
|
||||
---
|
||||
|
||||
> font = RL.LoadFontEx( string fileName, int fontSize, int fontChars{} )
|
||||
> font = RL.LoadFontEx( string fileName, int fontSize, int{} fontChars )
|
||||
|
||||
Load font from file with extended parameters. Loading the default character set
|
||||
|
||||
@@ -3955,171 +3952,117 @@ Get font texture atlas containing the glyphs.
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawLine3D( Vector3 startPos, Vector3 endPos, Color color )
|
||||
> RL.DrawLine3D( Vector3 startPos, Vector3 endPos, Color color )
|
||||
|
||||
Draw a line in 3D world space
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawPoint3D( Vector3 position, Color color )
|
||||
> RL.DrawPoint3D( Vector3 position, Color color )
|
||||
|
||||
Draw a point in 3D space, actually a small line
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCircle3D( Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color )
|
||||
> RL.DrawCircle3D( Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color )
|
||||
|
||||
Draw a circle in 3D world space
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
---
|
||||
|
||||
> RL.DrawTriangle3D( Vector3 v1, Vector3 v2, Vector3 v3, Color color )
|
||||
|
||||
Draw a color-filled triangle (Vertex in counter-clockwise order!)
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawTriangle3D( Vector3 v1, Vector3 v2, Vector3 v3, Color color )
|
||||
|
||||
Draw a color-filled triangle ( Vertex in counter-clockwise order! )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCube( Vector3 position, Vector3 size, Color color )
|
||||
> RL.DrawCube( Vector3 position, Vector3 size, Color color )
|
||||
|
||||
Draw cube
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCubeWires( Vector3 position, Vector3 size, Color color )
|
||||
> RL.DrawCubeWires( Vector3 position, Vector3 size, Color color )
|
||||
|
||||
Draw cube wires
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawSphere( Vector3 centerPos, float radius, Color color )
|
||||
> RL.DrawSphere( Vector3 centerPos, float radius, Color color )
|
||||
|
||||
Draw sphere
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawSphereEx( Vector3 centerPos, float radius, int rings, int slices, Color color )
|
||||
> RL.DrawSphereEx( Vector3 centerPos, float radius, int rings, int slices, Color color )
|
||||
|
||||
Draw sphere with extended parameters
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawSphereWires( Vector3 centerPos, float radius, int rings, int slices, Color color )
|
||||
> RL.DrawSphereWires( Vector3 centerPos, float radius, int rings, int slices, Color color )
|
||||
|
||||
Draw sphere wires
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCylinder( Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color )
|
||||
> RL.DrawCylinder( Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color )
|
||||
|
||||
Draw a cylinder/cone
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCylinderEx( Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color )
|
||||
> RL.DrawCylinderEx( Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color )
|
||||
|
||||
Draw a cylinder with base at startPos and top at endPos
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCylinderWires( Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color )
|
||||
> RL.DrawCylinderWires( Vector3 position, float radiusTop, float radiusBottom, float height, int slices, Color color )
|
||||
|
||||
Draw a cylinder/cone wires
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCylinderWiresEx( Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color )
|
||||
> RL.DrawCylinderWiresEx( Vector3 startPos, Vector3 endPos, float startRadius, float endRadius, int sides, Color color )
|
||||
|
||||
Draw a cylinder wires with base at startPos and top at endPos
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCapsule( Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color )
|
||||
> RL.DrawCapsule( Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color )
|
||||
|
||||
Draw a capsule with the center of its sphere caps at startPos and endPos
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawCapsuleWires( Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color )
|
||||
> RL.DrawCapsuleWires( Vector3 startPos, Vector3 endPos, float radius, int slices, int rings, Color color )
|
||||
|
||||
Draw capsule wireframe with the center of its sphere caps at startPos and endPos
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawPlane( Vector3 centerPos, Vector2 size, Color color )
|
||||
> RL.DrawPlane( Vector3 centerPos, Vector2 size, Color color )
|
||||
|
||||
Draw a plane XZ
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> RL.DrawQuad3DTexture( Texture texture, Vector3{} vertices, Vector2{} texCoords, Color{} colors )
|
||||
|
||||
Draw 3D textured quad. ( Texture coordinates opengl style 0.0 - 1.0 ).
|
||||
Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0).
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawRay( Ray ray, Color color )
|
||||
> RL.DrawRay( Ray ray, Color color )
|
||||
|
||||
Draw a ray line
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawGrid( int slices, float spacing )
|
||||
> RL.DrawGrid( int slices, float spacing )
|
||||
|
||||
Draw a grid ( Centered at ( 0, 0, 0 ) )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
Draw a grid (Centered at ( 0, 0, 0 ))
|
||||
|
||||
---
|
||||
|
||||
@@ -4131,17 +4074,15 @@ Draw a grid ( Centered at ( 0, 0, 0 ) )
|
||||
|
||||
Generate polygonal mesh
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
> mesh = RL.GenMeshPlane( float width, float length, int resX, int resZ )
|
||||
|
||||
Generate plane mesh ( With subdivisions )
|
||||
Generate plane mesh (With subdivisions)
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
@@ -4149,17 +4090,15 @@ Generate plane mesh ( With subdivisions )
|
||||
|
||||
Generate cuboid mesh
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
> mesh = RL.GenMeshSphere( float radius, int rings, int slices )
|
||||
|
||||
Generate sphere mesh ( Standard sphere )
|
||||
Generate sphere mesh (Standard sphere)
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
@@ -4167,8 +4106,7 @@ Generate sphere mesh ( Standard sphere )
|
||||
|
||||
Generate cylinder mesh
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
@@ -4176,8 +4114,7 @@ Generate cylinder mesh
|
||||
|
||||
Generate cone/pyramid mesh
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
@@ -4185,8 +4122,7 @@ Generate cone/pyramid mesh
|
||||
|
||||
Generate torus mesh
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
@@ -4194,8 +4130,7 @@ Generate torus mesh
|
||||
|
||||
Generate torus mesh
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
@@ -4203,55 +4138,35 @@ Generate torus mesh
|
||||
|
||||
Generate heightmap mesh from image data
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
> mesh = RL.GenMeshCustom( Mesh{} mesh, bool dynamic )
|
||||
> mesh = RL.GenMeshCustom( Mesh{} meshData, bool dynamic )
|
||||
|
||||
Generate custom mesh from vertex attribute data and uploads it into a VAO ( if supported ) and VBO
|
||||
Generate custom mesh from vertex attribute data and uploads it into a VAO (if supported) and VBO
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Mesh
|
||||
|
||||
---
|
||||
|
||||
> success = RL.UpdateMesh( Mesh mesh, Mesh{} updatedMesh )
|
||||
> RL.UpdateMesh( Mesh mesh, Mesh{} meshData )
|
||||
|
||||
Update mesh vertex data in GPU.
|
||||
Note! Mainly intented to be used with custom meshes.
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.UnloadMesh( Mesh mesh )
|
||||
|
||||
Unload mesh data from CPU and GPU
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawMesh( Mesh mesh, Material material, Matrix transform )
|
||||
> RL.DrawMesh( Mesh mesh, Material material, Matrix transform )
|
||||
|
||||
Draw a 3d mesh with material and transform
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawMeshInstanced( Mesh mesh, Material material, Matrix{} transforms, int instances )
|
||||
> RL.DrawMeshInstanced( Mesh mesh, Material material, Matrix{} transforms, int instances )
|
||||
|
||||
Draw multiple mesh instances with material and different transforms
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.SetMeshColor( Mesh mesh, Color color )
|
||||
@@ -4268,8 +4183,7 @@ NOTE: Currently only works on custom mesh
|
||||
|
||||
Export mesh data to file, returns true on success
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
- Success return bool
|
||||
|
||||
---
|
||||
|
||||
@@ -4277,18 +4191,14 @@ Export mesh data to file, returns true on success
|
||||
|
||||
Compute mesh bounding box limits
|
||||
|
||||
- Failure return false
|
||||
- Success return BoundingBox
|
||||
|
||||
---
|
||||
|
||||
> success = RL.GenMeshTangents( Mesh mesh )
|
||||
> RL.GenMeshTangents( Mesh mesh )
|
||||
|
||||
Compute mesh tangents
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
## Models - Material
|
||||
@@ -4299,50 +4209,34 @@ Compute mesh tangents
|
||||
|
||||
Load default material
|
||||
|
||||
- Success return int
|
||||
- Success return Material
|
||||
|
||||
---
|
||||
|
||||
> material = RL.CreateMaterial( Material{} material )
|
||||
> material = RL.CreateMaterial( Material{} materialData )
|
||||
|
||||
Load material from table. See material table definition
|
||||
|
||||
- Failure return false
|
||||
- Success return int
|
||||
|
||||
---
|
||||
|
||||
> success = RL.UnloadMaterial( Material material )
|
||||
|
||||
Unload material from GPU memory ( VRAM )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
- Success return Material
|
||||
|
||||
---
|
||||
|
||||
> RL.SetMaterialTexture( Material material, int mapType, Texture2D texture )
|
||||
|
||||
Set texture for a material map type ( MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS... )
|
||||
Set texture for a material map type (MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS...)
|
||||
|
||||
---
|
||||
|
||||
> success = RL.SetMaterialColor( Material material, int mapType, Color color )
|
||||
> RL.SetMaterialColor( Material material, int mapType, Color color )
|
||||
|
||||
Set color for a material map type
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.SetMaterialValue( Material material, int mapType, float value )
|
||||
> RL.SetMaterialValue( Material material, int mapType, float value )
|
||||
|
||||
Set value for a material map type
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> RL.SetMaterialShader( Material material, Shader shader )
|
||||
@@ -4351,56 +4245,48 @@ Set shader for material
|
||||
|
||||
---
|
||||
|
||||
> success = RL.SetMaterialParams( Material material, float{} params )
|
||||
> RL.SetMaterialParams( Material material, float{} params )
|
||||
|
||||
Set material generic parameters ( if required )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
Set material generic parameters (if required)
|
||||
|
||||
---
|
||||
|
||||
> texture = RL.GetMaterialTexture( Material material, int mapType )
|
||||
|
||||
Get texture from material map type. Returns -1 if no texture.
|
||||
Get texture from material map type. Returns -1 if no texture
|
||||
|
||||
- Failure return false
|
||||
- Success return int
|
||||
- Success return Texture
|
||||
|
||||
---
|
||||
|
||||
> color = RL.GetMaterialColor( Material material, int mapType )
|
||||
|
||||
Get color from material map type.
|
||||
Get color from material map type
|
||||
|
||||
- Failure return false
|
||||
- Success return Color
|
||||
|
||||
---
|
||||
|
||||
> value = RL.GetMaterialValue( Material material, int mapType )
|
||||
|
||||
Get color from material map type.
|
||||
Get color from material map type
|
||||
|
||||
- Failure return false
|
||||
- Success return float
|
||||
|
||||
---
|
||||
|
||||
> shader = RL.GetMaterialShader( Material material )
|
||||
|
||||
Get material shader. Returns -1 if no shader.
|
||||
Get material shader
|
||||
|
||||
- Failure return false
|
||||
- Success return Shader
|
||||
|
||||
---
|
||||
|
||||
> params = RL.GetMaterialParams( Material material )
|
||||
|
||||
Get material parameters.
|
||||
Get material parameters
|
||||
|
||||
- Failure return false
|
||||
- Success return float{}
|
||||
|
||||
---
|
||||
@@ -4411,64 +4297,42 @@ Get material parameters.
|
||||
|
||||
> model = RL.LoadModel( string fileName )
|
||||
|
||||
Load model from files ( Meshes and materials )
|
||||
Load model from files (Meshes and materials)
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Failure return nil
|
||||
- Success return Model
|
||||
|
||||
---
|
||||
|
||||
> model = RL.LoadModelFromMesh( Mesh mesh )
|
||||
|
||||
Load model from generated mesh ( Default material )
|
||||
Load model from generated mesh (Default material)
|
||||
|
||||
- Failure return -1
|
||||
- Success return int
|
||||
- Success return Model
|
||||
|
||||
---
|
||||
|
||||
> success = RL.UnloadModel( Model model )
|
||||
> RL.DrawModel( Model model, Vector3 position, float scale, Color tint )
|
||||
|
||||
Unload model ( Including meshes ) from memory ( RAM and/or VRAM )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
Draw a model (With texture if set)
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawModel( Model model, Vector3 position, float scale, Color tint )
|
||||
|
||||
Draw a model ( With texture if set )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.DrawModelEx( Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint )
|
||||
> RL.DrawModelEx( Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint )
|
||||
|
||||
Draw a model with extended parameters
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
---
|
||||
|
||||
> RL.SetModelMaterial( Model model, Material modelMaterial, Material material )
|
||||
|
||||
Copies material to model material. (Model material is the material id in models.)
|
||||
|
||||
---
|
||||
|
||||
> success = RL.SetModelMaterial( Model model, Material modelMaterial, Material material )
|
||||
> RL.SetModelMeshMaterial( Model model, int meshId, int materialId )
|
||||
|
||||
Copies material to model material. ( Model material is the material id in models. Material can be deleted if not used elsewhere )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.SetModelMeshMaterial( Model model, int meshId, int materialId )
|
||||
|
||||
Set material for a mesh ( Mesh and material on this model )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
Set material for a mesh (Mesh and material on this model)
|
||||
|
||||
---
|
||||
|
||||
@@ -4490,20 +4354,16 @@ Draw a billboard texture defined by source and rotation
|
||||
|
||||
---
|
||||
|
||||
> success = RL.SetModelTransform( Model model, Matrix transform )
|
||||
> RL.SetModelTransform( Model model, Matrix transform )
|
||||
|
||||
Set model transform matrix
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> transform = RL.GetModelTransform( Model model )
|
||||
|
||||
Get model transform matrix
|
||||
|
||||
- Failure return false
|
||||
- Success return Matrix
|
||||
|
||||
---
|
||||
@@ -4512,56 +4372,41 @@ Get model transform matrix
|
||||
|
||||
---
|
||||
|
||||
> animations, animationCount = RL.LoadModelAnimations( string fileName )
|
||||
> animations = RL.LoadModelAnimations( string fileName )
|
||||
|
||||
Load model animations from file
|
||||
|
||||
- Failure return -1
|
||||
- Success return int, int
|
||||
- Failure return nil
|
||||
- Success return ModelAnimations{}
|
||||
|
||||
---
|
||||
|
||||
> success = RL.UpdateModelAnimation( Model model, ModelAnimations animations, int animation, int frame )
|
||||
> RL.UpdateModelAnimation( Model model, ModelAnimation animation, int frame )
|
||||
|
||||
Update model animation pose
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> success = RL.UnloadModelAnimations( ModelAnimations animations )
|
||||
|
||||
Unload animation data
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
|
||||
---
|
||||
|
||||
> valid = RL.IsModelAnimationValid( Model model, ModelAnimations animations )
|
||||
> valid = RL.IsModelAnimationValid( Model model, ModelAnimation animation )
|
||||
|
||||
Check model animation skeleton match
|
||||
|
||||
- Failure return nil
|
||||
- Success return bool
|
||||
|
||||
---
|
||||
|
||||
> boneCount = RL.GetModelAnimationBoneCount( ModelAnimations animations, int animation )
|
||||
> boneCount = RL.GetModelAnimationBoneCount( ModelAnimation animation )
|
||||
|
||||
Return modelAnimation bone count
|
||||
|
||||
- Failure return false
|
||||
- Success return int
|
||||
|
||||
---
|
||||
|
||||
> frameCount = RL.GetModelAnimationFrameCount( ModelAnimations animations, int animation )
|
||||
> frameCount = RL.GetModelAnimationFrameCount( ModelAnimation animation )
|
||||
|
||||
Return modelAnimation frame count
|
||||
|
||||
- Failure return false
|
||||
- Success return int
|
||||
|
||||
---
|
||||
@@ -4574,7 +4419,6 @@ Return modelAnimation frame count
|
||||
|
||||
Check collision between two spheres
|
||||
|
||||
- Failure return nil
|
||||
- Success return bool
|
||||
|
||||
---
|
||||
@@ -4583,7 +4427,6 @@ Check collision between two spheres
|
||||
|
||||
Check collision between two bounding boxes
|
||||
|
||||
- Failure return nil
|
||||
- Success return bool
|
||||
|
||||
---
|
||||
@@ -4592,7 +4435,6 @@ Check collision between two bounding boxes
|
||||
|
||||
Check collision between box and sphere
|
||||
|
||||
- Failure return nil
|
||||
- Success return bool
|
||||
|
||||
---
|
||||
@@ -4601,7 +4443,6 @@ Check collision between box and sphere
|
||||
|
||||
Get collision info between ray and sphere. ( RayCollision is Lua table of { hit, distance, point, normal } )
|
||||
|
||||
- Failure return nil
|
||||
- Success return RayCollision
|
||||
|
||||
---
|
||||
@@ -4610,7 +4451,6 @@ Get collision info between ray and sphere. ( RayCollision is Lua table of { hit,
|
||||
|
||||
Get collision info between ray and box
|
||||
|
||||
- Failure return nil
|
||||
- Success return RayCollision
|
||||
|
||||
---
|
||||
@@ -4619,7 +4459,6 @@ Get collision info between ray and box
|
||||
|
||||
Get collision info between ray and mesh
|
||||
|
||||
- Failure return nil
|
||||
- Success return RayCollision
|
||||
|
||||
---
|
||||
@@ -4628,7 +4467,6 @@ Get collision info between ray and mesh
|
||||
|
||||
Get collision info between ray and triangle
|
||||
|
||||
- Failure return nil
|
||||
- Success return RayCollision
|
||||
|
||||
---
|
||||
@@ -4637,7 +4475,6 @@ Get collision info between ray and triangle
|
||||
|
||||
Get collision info between ray and quad
|
||||
|
||||
- Failure return nil
|
||||
- Success return RayCollision
|
||||
|
||||
---
|
||||
|
||||
299
ReiLua_API.lua
299
ReiLua_API.lua
@@ -2503,9 +2503,7 @@ function RL.ImageDrawRectangleLines( dst, rec, thick, color ) end
|
||||
---@return any RL.ImageDraw
|
||||
function RL.ImageDraw( dst, src, srcRec, dstRec, tint ) end
|
||||
|
||||
---Draw text ( Custom sprite font ) within an image ( Destination )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---Draw text (Custom sprite font) within an image (Destination)
|
||||
---@param dst any
|
||||
---@param font any
|
||||
---@param text string
|
||||
@@ -2513,7 +2511,7 @@ function RL.ImageDraw( dst, src, srcRec, dstRec, tint ) end
|
||||
---@param fontSize number
|
||||
---@param spacing number
|
||||
---@param tint table
|
||||
---@return any success
|
||||
---@return any RL.ImageDrawTextEx
|
||||
function RL.ImageDrawTextEx( dst, font, text, position, fontSize, spacing, tint ) end
|
||||
|
||||
-- Textures - Image Configuration
|
||||
@@ -2810,9 +2808,9 @@ function RL.LoadFont( fileName ) end
|
||||
---- Success return Font
|
||||
---@param fileName string
|
||||
---@param fontSize integer
|
||||
---@param fontChars{} integer
|
||||
---@param fontChars any
|
||||
---@return any font
|
||||
function RL.LoadFontEx( fileName, fontSize, fontChars{} ) end
|
||||
function RL.LoadFontEx( fileName, fontSize, fontChars ) end
|
||||
|
||||
---Load font from Image ( XNA style)
|
||||
---- Success return Font
|
||||
@@ -2889,174 +2887,142 @@ function RL.GetFontTexture( font ) end
|
||||
-- Models - Basic
|
||||
|
||||
---Draw a line in 3D world space
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param startPos table
|
||||
---@param endPos table
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawLine3D
|
||||
function RL.DrawLine3D( startPos, endPos, color ) end
|
||||
|
||||
---Draw a point in 3D space, actually a small line
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param position table
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawPoint3D
|
||||
function RL.DrawPoint3D( position, color ) end
|
||||
|
||||
---Draw a circle in 3D world space
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param center table
|
||||
---@param radius number
|
||||
---@param rotationAxis table
|
||||
---@param rotationAngle number
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCircle3D
|
||||
function RL.DrawCircle3D( center, radius, rotationAxis, rotationAngle, color ) end
|
||||
|
||||
---Draw a color-filled triangle ( Vertex in counter-clockwise order! )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---Draw a color-filled triangle (Vertex in counter-clockwise order!)
|
||||
---@param v1 table
|
||||
---@param v2 table
|
||||
---@param v3 table
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawTriangle3D
|
||||
function RL.DrawTriangle3D( v1, v2, v3, color ) end
|
||||
|
||||
---Draw cube
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param position table
|
||||
---@param size table
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCube
|
||||
function RL.DrawCube( position, size, color ) end
|
||||
|
||||
---Draw cube wires
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param position table
|
||||
---@param size table
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCubeWires
|
||||
function RL.DrawCubeWires( position, size, color ) end
|
||||
|
||||
---Draw sphere
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param centerPos table
|
||||
---@param radius number
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawSphere
|
||||
function RL.DrawSphere( centerPos, radius, color ) end
|
||||
|
||||
---Draw sphere with extended parameters
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param centerPos table
|
||||
---@param radius number
|
||||
---@param rings integer
|
||||
---@param slices integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawSphereEx
|
||||
function RL.DrawSphereEx( centerPos, radius, rings, slices, color ) end
|
||||
|
||||
---Draw sphere wires
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param centerPos table
|
||||
---@param radius number
|
||||
---@param rings integer
|
||||
---@param slices integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawSphereWires
|
||||
function RL.DrawSphereWires( centerPos, radius, rings, slices, color ) end
|
||||
|
||||
---Draw a cylinder/cone
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param position table
|
||||
---@param radiusTop number
|
||||
---@param radiusBottom number
|
||||
---@param height number
|
||||
---@param slices integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCylinder
|
||||
function RL.DrawCylinder( position, radiusTop, radiusBottom, height, slices, color ) end
|
||||
|
||||
---Draw a cylinder with base at startPos and top at endPos
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param startPos table
|
||||
---@param endPos table
|
||||
---@param startRadius number
|
||||
---@param endRadius number
|
||||
---@param sides integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCylinderEx
|
||||
function RL.DrawCylinderEx( startPos, endPos, startRadius, endRadius, sides, color ) end
|
||||
|
||||
---Draw a cylinder/cone wires
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param position table
|
||||
---@param radiusTop number
|
||||
---@param radiusBottom number
|
||||
---@param height number
|
||||
---@param slices integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCylinderWires
|
||||
function RL.DrawCylinderWires( position, radiusTop, radiusBottom, height, slices, color ) end
|
||||
|
||||
---Draw a cylinder wires with base at startPos and top at endPos
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param startPos table
|
||||
---@param endPos table
|
||||
---@param startRadius number
|
||||
---@param endRadius number
|
||||
---@param sides integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCylinderWiresEx
|
||||
function RL.DrawCylinderWiresEx( startPos, endPos, startRadius, endRadius, sides, color ) end
|
||||
|
||||
---Draw a capsule with the center of its sphere caps at startPos and endPos
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param startPos table
|
||||
---@param endPos table
|
||||
---@param radius number
|
||||
---@param slices integer
|
||||
---@param rings integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCapsule
|
||||
function RL.DrawCapsule( startPos, endPos, radius, slices, rings, color ) end
|
||||
|
||||
---Draw capsule wireframe with the center of its sphere caps at startPos and endPos
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param startPos table
|
||||
---@param endPos table
|
||||
---@param radius number
|
||||
---@param slices integer
|
||||
---@param rings integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawCapsuleWires
|
||||
function RL.DrawCapsuleWires( startPos, endPos, radius, slices, rings, color ) end
|
||||
|
||||
---Draw a plane XZ
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param centerPos table
|
||||
---@param size table
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawPlane
|
||||
function RL.DrawPlane( centerPos, size, color ) end
|
||||
|
||||
---Draw 3D textured quad. ( Texture coordinates opengl style 0.0 - 1.0 ).
|
||||
---Draw 3D textured quad. (Texture coordinates opengl style 0.0 - 1.0).
|
||||
---@param texture any
|
||||
---@param vertices any
|
||||
---@param texCoords any
|
||||
@@ -3065,34 +3031,28 @@ function RL.DrawPlane( centerPos, size, color ) end
|
||||
function RL.DrawQuad3DTexture( texture, vertices, texCoords, colors ) end
|
||||
|
||||
---Draw a ray line
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param ray any
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.DrawRay
|
||||
function RL.DrawRay( ray, color ) end
|
||||
|
||||
---Draw a grid ( Centered at ( 0, 0, 0 ) )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---Draw a grid (Centered at ( 0, 0, 0 ))
|
||||
---@param slices integer
|
||||
---@param spacing number
|
||||
---@return any success
|
||||
---@return any RL.DrawGrid
|
||||
function RL.DrawGrid( slices, spacing ) end
|
||||
|
||||
-- Models - Mesh
|
||||
|
||||
---Generate polygonal mesh
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---- Success return Mesh
|
||||
---@param sides integer
|
||||
---@param radius number
|
||||
---@return any mesh
|
||||
function RL.GenMeshPoly( sides, radius ) end
|
||||
|
||||
---Generate plane mesh ( With subdivisions )
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---Generate plane mesh (With subdivisions)
|
||||
---- Success return Mesh
|
||||
---@param width number
|
||||
---@param length number
|
||||
---@param resX integer
|
||||
@@ -3101,15 +3061,13 @@ function RL.GenMeshPoly( sides, radius ) end
|
||||
function RL.GenMeshPlane( width, length, resX, resZ ) end
|
||||
|
||||
---Generate cuboid mesh
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---- Success return Mesh
|
||||
---@param size table
|
||||
---@return any mesh
|
||||
function RL.GenMeshCube( size ) end
|
||||
|
||||
---Generate sphere mesh ( Standard sphere )
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---Generate sphere mesh (Standard sphere)
|
||||
---- Success return Mesh
|
||||
---@param radius number
|
||||
---@param rings integer
|
||||
---@param slices integer
|
||||
@@ -3117,8 +3075,7 @@ function RL.GenMeshCube( size ) end
|
||||
function RL.GenMeshSphere( radius, rings, slices ) end
|
||||
|
||||
---Generate cylinder mesh
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---- Success return Mesh
|
||||
---@param radius number
|
||||
---@param height number
|
||||
---@param slices integer
|
||||
@@ -3126,8 +3083,7 @@ function RL.GenMeshSphere( radius, rings, slices ) end
|
||||
function RL.GenMeshCylinder( radius, height, slices ) end
|
||||
|
||||
---Generate cone/pyramid mesh
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---- Success return Mesh
|
||||
---@param radius number
|
||||
---@param height number
|
||||
---@param slices integer
|
||||
@@ -3135,8 +3091,7 @@ function RL.GenMeshCylinder( radius, height, slices ) end
|
||||
function RL.GenMeshCone( radius, height, slices ) end
|
||||
|
||||
---Generate torus mesh
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---- Success return Mesh
|
||||
---@param radius number
|
||||
---@param size number
|
||||
---@param radSeg integer
|
||||
@@ -3145,8 +3100,7 @@ function RL.GenMeshCone( radius, height, slices ) end
|
||||
function RL.GenMeshTorus( radius, size, radSeg, sides ) end
|
||||
|
||||
---Generate torus mesh
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---- Success return Mesh
|
||||
---@param radius number
|
||||
---@param size number
|
||||
---@param radSeg integer
|
||||
@@ -3155,54 +3109,39 @@ function RL.GenMeshTorus( radius, size, radSeg, sides ) end
|
||||
function RL.GenMeshKnot( radius, size, radSeg, sides ) end
|
||||
|
||||
---Generate heightmap mesh from image data
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---- Success return Mesh
|
||||
---@param heightmap any
|
||||
---@param size table
|
||||
---@return any mesh
|
||||
function RL.GenMeshHeightmap( heightmap, size ) end
|
||||
|
||||
---Generate custom mesh from vertex attribute data and uploads it into a VAO ( if supported ) and VBO
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---@param mesh any
|
||||
---Generate custom mesh from vertex attribute data and uploads it into a VAO (if supported) and VBO
|
||||
---- Success return Mesh
|
||||
---@param meshData any
|
||||
---@param dynamic boolean
|
||||
---@return any mesh
|
||||
function RL.GenMeshCustom( mesh, dynamic ) end
|
||||
function RL.GenMeshCustom( meshData, dynamic ) end
|
||||
|
||||
---Update mesh vertex data in GPU.
|
||||
---Note! Mainly intented to be used with custom meshes.
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param mesh any
|
||||
---@param updatedMesh any
|
||||
---@return any success
|
||||
function RL.UpdateMesh( mesh, updatedMesh ) end
|
||||
|
||||
---Unload mesh data from CPU and GPU
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param mesh any
|
||||
---@return any success
|
||||
function RL.UnloadMesh( mesh ) end
|
||||
---@param meshData any
|
||||
---@return any RL.UpdateMesh
|
||||
function RL.UpdateMesh( mesh, meshData ) end
|
||||
|
||||
---Draw a 3d mesh with material and transform
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param mesh any
|
||||
---@param material any
|
||||
---@param transform table
|
||||
---@return any success
|
||||
---@return any RL.DrawMesh
|
||||
function RL.DrawMesh( mesh, material, transform ) end
|
||||
|
||||
---Draw multiple mesh instances with material and different transforms
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param mesh any
|
||||
---@param material any
|
||||
---@param transforms any
|
||||
---@param instances integer
|
||||
---@return any success
|
||||
---@return any RL.DrawMeshInstanced
|
||||
function RL.DrawMeshInstanced( mesh, material, transforms, instances ) end
|
||||
|
||||
---Updades mesh color vertex attribute buffer
|
||||
@@ -3215,49 +3154,37 @@ function RL.DrawMeshInstanced( mesh, material, transforms, instances ) end
|
||||
function RL.SetMeshColor( mesh, color ) end
|
||||
|
||||
---Export mesh data to file, returns true on success
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---- Success return bool
|
||||
---@param mesh any
|
||||
---@param fileName string
|
||||
---@return any success
|
||||
function RL.ExportMesh( mesh, fileName ) end
|
||||
|
||||
---Compute mesh bounding box limits
|
||||
---- Failure return false
|
||||
---- Success return BoundingBox
|
||||
---@param mesh any
|
||||
---@return any boundingBox
|
||||
function RL.GetMeshBoundingBox( mesh ) end
|
||||
|
||||
---Compute mesh tangents
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param mesh any
|
||||
---@return any success
|
||||
---@return any RL.GenMeshTangents
|
||||
function RL.GenMeshTangents( mesh ) end
|
||||
|
||||
-- Models - Material
|
||||
|
||||
---Load default material
|
||||
---- Success return int
|
||||
---- Success return Material
|
||||
---@return any material
|
||||
function RL.LoadMaterialDefault() end
|
||||
|
||||
---Load material from table. See material table definition
|
||||
---- Failure return false
|
||||
---- Success return int
|
||||
---@param material any
|
||||
---- Success return Material
|
||||
---@param materialData any
|
||||
---@return any material
|
||||
function RL.CreateMaterial( material ) end
|
||||
function RL.CreateMaterial( materialData ) end
|
||||
|
||||
---Unload material from GPU memory ( VRAM )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param material any
|
||||
---@return any success
|
||||
function RL.UnloadMaterial( material ) end
|
||||
|
||||
---Set texture for a material map type ( MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS... )
|
||||
---Set texture for a material map type (MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNESS...)
|
||||
---@param material any
|
||||
---@param mapType integer
|
||||
---@param texture any
|
||||
@@ -3265,21 +3192,17 @@ function RL.UnloadMaterial( material ) end
|
||||
function RL.SetMaterialTexture( material, mapType, texture ) end
|
||||
|
||||
---Set color for a material map type
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param material any
|
||||
---@param mapType integer
|
||||
---@param color table
|
||||
---@return any success
|
||||
---@return any RL.SetMaterialColor
|
||||
function RL.SetMaterialColor( material, mapType, color ) end
|
||||
|
||||
---Set value for a material map type
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param material any
|
||||
---@param mapType integer
|
||||
---@param value number
|
||||
---@return any success
|
||||
---@return any RL.SetMaterialValue
|
||||
function RL.SetMaterialValue( material, mapType, value ) end
|
||||
|
||||
---Set shader for material
|
||||
@@ -3288,47 +3211,40 @@ function RL.SetMaterialValue( material, mapType, value ) end
|
||||
---@return any RL.SetMaterialShader
|
||||
function RL.SetMaterialShader( material, shader ) end
|
||||
|
||||
---Set material generic parameters ( if required )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---Set material generic parameters (if required)
|
||||
---@param material any
|
||||
---@param params any
|
||||
---@return any success
|
||||
---@return any RL.SetMaterialParams
|
||||
function RL.SetMaterialParams( material, params ) end
|
||||
|
||||
---Get texture from material map type. Returns -1 if no texture.
|
||||
---- Failure return false
|
||||
---- Success return int
|
||||
---Get texture from material map type. Returns -1 if no texture
|
||||
---- Success return Texture
|
||||
---@param material any
|
||||
---@param mapType integer
|
||||
---@return any texture
|
||||
function RL.GetMaterialTexture( material, mapType ) end
|
||||
|
||||
---Get color from material map type.
|
||||
---- Failure return false
|
||||
---Get color from material map type
|
||||
---- Success return Color
|
||||
---@param material any
|
||||
---@param mapType integer
|
||||
---@return any color
|
||||
function RL.GetMaterialColor( material, mapType ) end
|
||||
|
||||
---Get color from material map type.
|
||||
---- Failure return false
|
||||
---Get color from material map type
|
||||
---- Success return float
|
||||
---@param material any
|
||||
---@param mapType integer
|
||||
---@return any value
|
||||
function RL.GetMaterialValue( material, mapType ) end
|
||||
|
||||
---Get material shader. Returns -1 if no shader.
|
||||
---- Failure return false
|
||||
---Get material shader
|
||||
---- Success return Shader
|
||||
---@param material any
|
||||
---@return any shader
|
||||
function RL.GetMaterialShader( material ) end
|
||||
|
||||
---Get material parameters.
|
||||
---- Failure return false
|
||||
---Get material parameters
|
||||
---- Success return float{}
|
||||
---@param material any
|
||||
---@return any params
|
||||
@@ -3336,65 +3252,49 @@ function RL.GetMaterialParams( material ) end
|
||||
|
||||
-- Models - Model
|
||||
|
||||
---Load model from files ( Meshes and materials )
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---Load model from files (Meshes and materials)
|
||||
---- Failure return nil
|
||||
---- Success return Model
|
||||
---@param fileName string
|
||||
---@return any model
|
||||
function RL.LoadModel( fileName ) end
|
||||
|
||||
---Load model from generated mesh ( Default material )
|
||||
---- Failure return -1
|
||||
---- Success return int
|
||||
---Load model from generated mesh (Default material)
|
||||
---- Success return Model
|
||||
---@param mesh any
|
||||
---@return any model
|
||||
function RL.LoadModelFromMesh( mesh ) end
|
||||
|
||||
---Unload model ( Including meshes ) from memory ( RAM and/or VRAM )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param model any
|
||||
---@return any success
|
||||
function RL.UnloadModel( model ) end
|
||||
|
||||
---Draw a model ( With texture if set )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---Draw a model (With texture if set)
|
||||
---@param model any
|
||||
---@param position table
|
||||
---@param scale number
|
||||
---@param tint table
|
||||
---@return any success
|
||||
---@return any RL.DrawModel
|
||||
function RL.DrawModel( model, position, scale, tint ) end
|
||||
|
||||
---Draw a model with extended parameters
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param model any
|
||||
---@param position table
|
||||
---@param rotationAxis table
|
||||
---@param rotationAngle number
|
||||
---@param scale table
|
||||
---@param tint table
|
||||
---@return any success
|
||||
---@return any RL.DrawModelEx
|
||||
function RL.DrawModelEx( model, position, rotationAxis, rotationAngle, scale, tint ) end
|
||||
|
||||
---Copies material to model material. ( Model material is the material id in models. Material can be deleted if not used elsewhere )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---Copies material to model material. (Model material is the material id in models.)
|
||||
---@param model any
|
||||
---@param modelMaterial any
|
||||
---@param material any
|
||||
---@return any success
|
||||
---@return any RL.SetModelMaterial
|
||||
function RL.SetModelMaterial( model, modelMaterial, material ) end
|
||||
|
||||
---Set material for a mesh ( Mesh and material on this model )
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---Set material for a mesh (Mesh and material on this model)
|
||||
---@param model any
|
||||
---@param meshId integer
|
||||
---@param materialId integer
|
||||
---@return any success
|
||||
---@return any RL.SetModelMeshMaterial
|
||||
function RL.SetModelMeshMaterial( model, meshId, materialId ) end
|
||||
|
||||
---Draw a billboard texture
|
||||
@@ -3430,15 +3330,12 @@ function RL.DrawBillboardRec( camera, texture, source, position, size, tint ) e
|
||||
function RL.DrawBillboardPro( camera, texture, source, position, up, size, origin, rotation, tint ) end
|
||||
|
||||
---Set model transform matrix
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param model any
|
||||
---@param transform table
|
||||
---@return any success
|
||||
---@return any RL.SetModelTransform
|
||||
function RL.SetModelTransform( model, transform ) end
|
||||
|
||||
---Get model transform matrix
|
||||
---- Failure return false
|
||||
---- Success return Matrix
|
||||
---@param model any
|
||||
---@return any transform
|
||||
@@ -3447,58 +3344,41 @@ function RL.GetModelTransform( model ) end
|
||||
-- Model - Animations
|
||||
|
||||
---Load model animations from file
|
||||
---- Failure return -1
|
||||
---- Success return int, int
|
||||
---- Failure return nil
|
||||
---- Success return ModelAnimations{}
|
||||
---@param fileName string
|
||||
---@return any animations
|
||||
---@return any animationCount
|
||||
function RL.LoadModelAnimations( fileName ) end
|
||||
|
||||
---Update model animation pose
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param model any
|
||||
---@param animations any
|
||||
---@param animation integer
|
||||
---@param animation any
|
||||
---@param frame integer
|
||||
---@return any success
|
||||
function RL.UpdateModelAnimation( model, animations, animation, frame ) end
|
||||
|
||||
---Unload animation data
|
||||
---- Failure return false
|
||||
---- Success return true
|
||||
---@param animations any
|
||||
---@return any success
|
||||
function RL.UnloadModelAnimations( animations ) end
|
||||
---@return any RL.UpdateModelAnimation
|
||||
function RL.UpdateModelAnimation( model, animation, frame ) end
|
||||
|
||||
---Check model animation skeleton match
|
||||
---- Failure return nil
|
||||
---- Success return bool
|
||||
---@param model any
|
||||
---@param animations any
|
||||
---@param animation any
|
||||
---@return any valid
|
||||
function RL.IsModelAnimationValid( model, animations ) end
|
||||
function RL.IsModelAnimationValid( model, animation ) end
|
||||
|
||||
---Return modelAnimation bone count
|
||||
---- Failure return false
|
||||
---- Success return int
|
||||
---@param animations any
|
||||
---@param animation integer
|
||||
---@param animation any
|
||||
---@return any boneCount
|
||||
function RL.GetModelAnimationBoneCount( animations, animation ) end
|
||||
function RL.GetModelAnimationBoneCount( animation ) end
|
||||
|
||||
---Return modelAnimation frame count
|
||||
---- Failure return false
|
||||
---- Success return int
|
||||
---@param animations any
|
||||
---@param animation integer
|
||||
---@param animation any
|
||||
---@return any frameCount
|
||||
function RL.GetModelAnimationFrameCount( animations, animation ) end
|
||||
function RL.GetModelAnimationFrameCount( animation ) end
|
||||
|
||||
-- Model - Collision
|
||||
|
||||
---Check collision between two spheres
|
||||
---- Failure return nil
|
||||
---- Success return bool
|
||||
---@param center1 table
|
||||
---@param radius1 number
|
||||
@@ -3508,7 +3388,6 @@ function RL.GetModelAnimationFrameCount( animations, animation ) end
|
||||
function RL.CheckCollisionSpheres( center1, radius1, center2, radius2 ) end
|
||||
|
||||
---Check collision between two bounding boxes
|
||||
---- Failure return nil
|
||||
---- Success return bool
|
||||
---@param box1 any
|
||||
---@param box2 any
|
||||
@@ -3516,7 +3395,6 @@ function RL.CheckCollisionSpheres( center1, radius1, center2, radius2 ) end
|
||||
function RL.CheckCollisionBoxes( box1, box2 ) end
|
||||
|
||||
---Check collision between box and sphere
|
||||
---- Failure return nil
|
||||
---- Success return bool
|
||||
---@param box any
|
||||
---@param center table
|
||||
@@ -3525,7 +3403,6 @@ function RL.CheckCollisionBoxes( box1, box2 ) end
|
||||
function RL.CheckCollisionBoxSphere( box, center, radius ) end
|
||||
|
||||
---Get collision info between ray and sphere. ( RayCollision is Lua table of { hit, distance, point, normal } )
|
||||
---- Failure return nil
|
||||
---- Success return RayCollision
|
||||
---@param ray any
|
||||
---@param center table
|
||||
@@ -3534,7 +3411,6 @@ function RL.CheckCollisionBoxSphere( box, center, radius ) end
|
||||
function RL.GetRayCollisionSphere( ray, center, radius ) end
|
||||
|
||||
---Get collision info between ray and box
|
||||
---- Failure return nil
|
||||
---- Success return RayCollision
|
||||
---@param ray any
|
||||
---@param box any
|
||||
@@ -3542,7 +3418,6 @@ function RL.GetRayCollisionSphere( ray, center, radius ) end
|
||||
function RL.GetRayCollisionBox( ray, box ) end
|
||||
|
||||
---Get collision info between ray and mesh
|
||||
---- Failure return nil
|
||||
---- Success return RayCollision
|
||||
---@param ray any
|
||||
---@param mesh any
|
||||
@@ -3551,7 +3426,6 @@ function RL.GetRayCollisionBox( ray, box ) end
|
||||
function RL.GetRayCollisionMesh( ray, mesh, transform ) end
|
||||
|
||||
---Get collision info between ray and triangle
|
||||
---- Failure return nil
|
||||
---- Success return RayCollision
|
||||
---@param ray any
|
||||
---@param p1 table
|
||||
@@ -3561,7 +3435,6 @@ function RL.GetRayCollisionMesh( ray, mesh, transform ) end
|
||||
function RL.GetRayCollisionTriangle( ray, p1, p2, p3 ) end
|
||||
|
||||
---Get collision info between ray and quad
|
||||
---- Failure return nil
|
||||
---- Success return RayCollision
|
||||
---@param ray any
|
||||
---@param p1 table
|
||||
|
||||
@@ -5,6 +5,7 @@ KEY CHANGES:
|
||||
- CHANGED: Switch from ID based objects to userdata.
|
||||
- CHANGED: Wrong arguments now largely crash the application instead of TraceLog state->logLevelInvalid.
|
||||
- CHANGED: Rely mostly on luaL_check* functions for arg checking.
|
||||
- CHANGED: ModelAnimations are changed to separate ModelAnimation types as in Raylib.
|
||||
|
||||
DETAILED CHANGES:
|
||||
- CHANGED: GenImageColor now takes Vector2 as size.
|
||||
@@ -17,6 +18,7 @@ DETAILED CHANGES:
|
||||
- REMOVED: UnloadFont.
|
||||
- ADDED: LoadFontEx takes also fontChars.
|
||||
- REMOVED: UnloadWave and UnloadSound.
|
||||
- REMOVED: UnloadMesh, UnloadMaterial, UnloadModel and UnloadModelAnimations.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Release: ReiLua version 0.5.0 Using Raylib 4.5
|
||||
|
||||
@@ -136,5 +136,5 @@ function RL.draw()
|
||||
|
||||
camera:endMode3D()
|
||||
|
||||
RL.DrawText( 0, "Use keys [Y][R][G][B] to toggle lights", { 10, 10 }, 20, 4, RL.DARKGRAY )
|
||||
RL.DrawText( RL.defaultFont, "Use keys [Y][R][G][B] to toggle lights", { 10, 10 }, 20, 4, RL.DARKGRAY )
|
||||
end
|
||||
|
||||
@@ -9,6 +9,7 @@ local TILE_SIZE = 32
|
||||
|
||||
local monitor = 0
|
||||
local camera = {}
|
||||
local groundRenderTexture = -1
|
||||
local groundTexture = -1
|
||||
local tilesetTex = -1
|
||||
local heigthImage = -1
|
||||
@@ -47,10 +48,11 @@ function RL.init()
|
||||
|
||||
mesh = RL.GenMeshHeightmap( heigthImage, { 16, 4, 16 } )
|
||||
tilesetTex = RL.LoadTexture( RL.GetBasePath().."../resources/images/tiles.png" )
|
||||
groundTexture = RL.LoadRenderTexture( { TILE_SIZE * 16, TILE_SIZE * 16 } )
|
||||
groundRenderTexture = RL.LoadRenderTexture( { TILE_SIZE * 16, TILE_SIZE * 16 } )
|
||||
groundTexture = RL.GetRenderTextureTexture( groundRenderTexture )
|
||||
|
||||
-- Draw to ground texture.
|
||||
RL.BeginTextureMode( groundTexture )
|
||||
RL.BeginTextureMode( groundRenderTexture )
|
||||
|
||||
for x = 1, 16 do
|
||||
for y = 1, 16 do
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
local monitor = 0
|
||||
local camera = -1
|
||||
local texture = nil
|
||||
local material = -1
|
||||
local model = -1
|
||||
local animations = -1
|
||||
local animationCount = 0
|
||||
local animations = {}
|
||||
local frame = 0
|
||||
local curAnim = 0
|
||||
local frameCount = 0
|
||||
@@ -24,12 +24,14 @@ function RL.init()
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
|
||||
texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/monkey_tex.png" )
|
||||
|
||||
material = RL.CreateMaterial( {
|
||||
maps = {
|
||||
{
|
||||
RL.MATERIAL_MAP_ALBEDO,
|
||||
{
|
||||
texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/monkey_tex.png" ),
|
||||
texture = texture,
|
||||
color = RL.WHITE,
|
||||
},
|
||||
},
|
||||
@@ -38,21 +40,19 @@ function RL.init()
|
||||
|
||||
model = RL.LoadModel( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
|
||||
RL.SetModelMaterial( model, 0, material )
|
||||
animations, animationCount = RL.LoadModelAnimations( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
|
||||
|
||||
print( "animationCount", animationCount )
|
||||
animations = RL.LoadModelAnimations( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
|
||||
end
|
||||
|
||||
function RL.process( delta )
|
||||
if RL.IsKeyPressed( RL.KEY_ENTER ) then
|
||||
curAnim = curAnim + 1
|
||||
|
||||
if animationCount <= curAnim then
|
||||
if #animations <= curAnim then
|
||||
curAnim = 0
|
||||
end
|
||||
|
||||
frame = 0.0
|
||||
frameCount = RL.GetModelAnimationFrameCount( animations, curAnim )
|
||||
frameCount = RL.GetModelAnimationFrameCount( animations[ curAnim + 1 ] )
|
||||
elseif RL.IsKeyPressed( RL.KEY_UP ) then
|
||||
animSpeed = animSpeed + 5
|
||||
elseif RL.IsKeyPressed( RL.KEY_DOWN ) then
|
||||
@@ -60,7 +60,7 @@ function RL.process( delta )
|
||||
end
|
||||
|
||||
if RL.IsKeyDown( RL.KEY_SPACE ) then
|
||||
RL.UpdateModelAnimation( model, animations, curAnim, math.floor( frame ) )
|
||||
RL.UpdateModelAnimation( model, animations[ curAnim + 1 ], math.floor( frame ) )
|
||||
frame = frame + animSpeed * delta
|
||||
|
||||
if frameCount < frame then
|
||||
@@ -80,7 +80,7 @@ function RL.draw()
|
||||
RL.DrawModelEx( model, { 0, 0, 0 }, { 1.0, 0.0, 0.0 }, -90.0, { 1.0, 1.0, 1.0 }, RL.WHITE )
|
||||
RL.EndMode3D()
|
||||
|
||||
RL.DrawText( 0,
|
||||
RL.DrawText( RL.defaultFont,
|
||||
"Enter: Change animation\
|
||||
Space: Play animation\
|
||||
Up arrow: Inreace animation speed\
|
||||
|
||||
@@ -55,6 +55,8 @@ function RL.init()
|
||||
shader = RL.LoadShader( RL.GetBasePath().."../resources/shaders/glsl330/lightmap.vs",
|
||||
RL.GetBasePath().."../resources/shaders/glsl330/lightmap.fs" )
|
||||
|
||||
print( "shader", shader )
|
||||
|
||||
local materialData = {
|
||||
shader = shader,
|
||||
maps = {
|
||||
@@ -77,6 +79,9 @@ function RL.init()
|
||||
},
|
||||
}
|
||||
material = RL.CreateMaterial( materialData )
|
||||
|
||||
print( "material", material )
|
||||
|
||||
matrix = RL.MatrixMultiply( RL.MatrixIdentity(), RL.MatrixTranslate( { -4, 0, -4 } ) )
|
||||
end
|
||||
|
||||
@@ -102,3 +107,10 @@ function RL.draw()
|
||||
RL.DrawMesh( mesh, material, matrix )
|
||||
camera:endMode3D()
|
||||
end
|
||||
|
||||
function RL.exit()
|
||||
material = nil
|
||||
collectgarbage( "collect" )
|
||||
tileTexture = nil
|
||||
collectgarbage( "collect" )
|
||||
end
|
||||
@@ -32,5 +32,5 @@ end
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
RL.DrawTexture( texture, { 20, 20 }, RL.WHITE )
|
||||
RL.DrawText( RL.fontDefault, text, textPos, 20, 2, textColor )
|
||||
RL.DrawText( RL.defaultFont, text, textPos, 20, 2, textColor )
|
||||
end
|
||||
|
||||
@@ -79,6 +79,10 @@ void uluaPushWave( lua_State *L, Wave wave );
|
||||
void uluaPushSound( lua_State *L, Sound sound );
|
||||
void uluaPushMusic( lua_State *L, Music music );
|
||||
void uluaPushLight( lua_State *L, Light light );
|
||||
void uluaPushMaterial( lua_State *L, Material material );
|
||||
void uluaPushMesh( lua_State *L, Mesh mesh );
|
||||
void uluaPushModel( lua_State *L, Model model );
|
||||
void uluaPushModelAnimation( lua_State *L, ModelAnimation modelAnimation );
|
||||
|
||||
int uluaGetTableLen( lua_State *L );
|
||||
int uluaGetTableLenIndex( lua_State *L, int index );
|
||||
|
||||
@@ -38,7 +38,6 @@ int lmodelsGenMeshKnot( lua_State *L );
|
||||
int lmodelsGenMeshHeightmap( lua_State *L );
|
||||
int lmodelsGenMeshCustom( lua_State *L );
|
||||
int lmodelsUpdateMesh( lua_State *L );
|
||||
int lmodelsUnloadMesh( lua_State *L );
|
||||
int lmodelsDrawMesh( lua_State *L );
|
||||
int lmodelsDrawMeshInstanced( lua_State *L );
|
||||
int lmodelsSetMeshColor( lua_State *L );
|
||||
@@ -48,7 +47,6 @@ int lmodelsGenMeshTangents( lua_State *L );
|
||||
/* Material. */
|
||||
int lmodelsLoadMaterialDefault( lua_State *L );
|
||||
int lmodelsCreateMaterial( lua_State *L );
|
||||
int lmodelsUnloadMaterial( lua_State *L );
|
||||
int lmodelsSetMaterialTexture( lua_State *L );
|
||||
int lmodelsSetMaterialColor( lua_State *L );
|
||||
int lmodelsSetMaterialValue( lua_State *L );
|
||||
@@ -62,7 +60,6 @@ int lmodelsGetMaterialParams( lua_State *L );
|
||||
/* Model. */
|
||||
int lmodelsLoadModel( lua_State *L );
|
||||
int lmodelsLoadModelFromMesh( lua_State *L );
|
||||
int lmodelsUnloadModel( lua_State *L );
|
||||
int lmodelsDrawModel( lua_State *L );
|
||||
int lmodelsDrawModelEx( lua_State *L );
|
||||
int lmodelsSetModelMaterial( lua_State *L );
|
||||
@@ -75,7 +72,6 @@ int lmodelsGetModelTransform( lua_State *L );
|
||||
/* Animations. */
|
||||
int lmodelsLoadModelAnimations( lua_State *L );
|
||||
int lmodelsUpdateModelAnimation( lua_State *L );
|
||||
int lmodelsUnloadModelAnimations( lua_State *L );
|
||||
int lmodelsIsModelAnimationValid( lua_State *L );
|
||||
int lmodelsGetModelAnimationBoneCount( lua_State *L );
|
||||
int lmodelsGetModelAnimationFrameCount( lua_State *L );
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
|
||||
#define ALLOC_PAGE_SIZE 256
|
||||
|
||||
typedef struct {
|
||||
ModelAnimation *animations;
|
||||
unsigned int animCount;
|
||||
} ModelAnimations;
|
||||
|
||||
typedef struct {
|
||||
char *exePath;
|
||||
bool hasWindow;
|
||||
@@ -14,23 +9,6 @@ typedef struct {
|
||||
lua_State *luaState;
|
||||
Vector2 resolution;
|
||||
int logLevelInvalid;
|
||||
/* Resources. */
|
||||
/* Meshes. */
|
||||
Mesh **meshes;
|
||||
size_t meshCount;
|
||||
size_t meshAlloc;
|
||||
/* Materials. */
|
||||
Material **materials;
|
||||
size_t materialCount;
|
||||
size_t materialAlloc;
|
||||
/* Models. */
|
||||
Model **models;
|
||||
size_t modelCount;
|
||||
size_t modelAlloc;
|
||||
/* ModelAnimations. */
|
||||
ModelAnimations **animations;
|
||||
size_t animationCount;
|
||||
size_t animationAlloc;
|
||||
/* Raylib GLFW input callback events. */
|
||||
/* Window events. */
|
||||
GLFWwindowsizefun raylibWindowSizeCallback;
|
||||
|
||||
126
src/lua_core.c
126
src/lua_core.c
@@ -194,7 +194,7 @@ static void defineMusic() {
|
||||
lua_setfield( L, -2, "__gc" );
|
||||
}
|
||||
|
||||
/* Music. */
|
||||
/* Light. */
|
||||
static void defineLight() {
|
||||
lua_State *L = state->luaState;
|
||||
|
||||
@@ -203,6 +203,93 @@ static void defineLight() {
|
||||
lua_setfield( L, -2, "__index" );
|
||||
}
|
||||
|
||||
/* Material. */
|
||||
static int gcMaterial( lua_State *L ) {
|
||||
Material *material = luaL_checkudata ( L, 1, "Material" );
|
||||
printf( "gcMaterial\n" );
|
||||
|
||||
// int MAX_MATERIAL_MAPS = 12;
|
||||
|
||||
|
||||
// Unload loaded texture maps (avoid unloading default texture, managed by raylib)
|
||||
// if ( material->maps != NULL ) {
|
||||
// for ( int i = 0; i < MAX_MATERIAL_MAPS; i++ ) {
|
||||
// if ( material->maps[i].texture.id != rlGetTextureIdDefault() ) {
|
||||
// printf( "gcMaterial material->maps[i].texture.id = %d\n", material->maps[i].texture.id );
|
||||
// rlUnloadTexture( material->maps[i].texture.id );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/* Custom UnloadMaterial since we don't want to free Shaders or Textures. */
|
||||
RL_FREE( material->maps );
|
||||
}
|
||||
|
||||
static void defineMaterial() {
|
||||
lua_State *L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Material" );
|
||||
lua_pushvalue( L, -1 );
|
||||
lua_setfield( L, -2, "__index" );
|
||||
lua_pushcfunction( L, gcMaterial );
|
||||
lua_setfield( L, -2, "__gc" );
|
||||
}
|
||||
|
||||
/* Mesh. */
|
||||
static int gcMesh( lua_State *L ) {
|
||||
Mesh *mesh = luaL_checkudata ( L, 1, "Mesh" );
|
||||
printf( "gcMesh\n" );
|
||||
|
||||
UnloadMesh( *mesh );
|
||||
}
|
||||
|
||||
static void defineMesh() {
|
||||
lua_State *L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Mesh" );
|
||||
lua_pushvalue( L, -1 );
|
||||
lua_setfield( L, -2, "__index" );
|
||||
lua_pushcfunction( L, gcMesh );
|
||||
lua_setfield( L, -2, "__gc" );
|
||||
}
|
||||
|
||||
/* Model. */
|
||||
static int gcModel( lua_State *L ) {
|
||||
Model *model = luaL_checkudata ( L, 1, "Model" );
|
||||
printf( "gcModel\n" );
|
||||
|
||||
UnloadModel( *model );
|
||||
// UnloadModelKeepMeshes( *model );
|
||||
}
|
||||
|
||||
static void defineModel() {
|
||||
lua_State *L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "Model" );
|
||||
lua_pushvalue( L, -1 );
|
||||
lua_setfield( L, -2, "__index" );
|
||||
lua_pushcfunction( L, gcModel );
|
||||
lua_setfield( L, -2, "__gc" );
|
||||
}
|
||||
|
||||
/* ModelAnimation. */
|
||||
static int gcModelAnimation( lua_State *L ) {
|
||||
ModelAnimation *modelAnimation = luaL_checkudata ( L, 1, "ModelAnimation" );
|
||||
printf( "gcModelAnimation\n" );
|
||||
|
||||
UnloadModelAnimation( *modelAnimation );
|
||||
}
|
||||
|
||||
static void defineModelAnimation() {
|
||||
lua_State *L = state->luaState;
|
||||
|
||||
luaL_newmetatable( L, "ModelAnimation" );
|
||||
lua_pushvalue( L, -1 );
|
||||
lua_setfield( L, -2, "__index" );
|
||||
lua_pushcfunction( L, gcModelAnimation );
|
||||
lua_setfield( L, -2, "__gc" );
|
||||
}
|
||||
|
||||
/* Assing globals. */
|
||||
|
||||
static void assignGlobalInt( int value, const char *name ) {
|
||||
@@ -243,7 +330,10 @@ static void defineGlobals() {
|
||||
lua_getglobal( L, "RL" );
|
||||
|
||||
uluaPushFont( L, GetFontDefault() );
|
||||
lua_setfield( L, -2, "fontDefault" );
|
||||
lua_setfield( L, -2, "defaultFont" );
|
||||
|
||||
uluaPushMaterial( L, LoadMaterialDefault() );
|
||||
lua_setfield( L, -2, "defaultMaterial" );
|
||||
|
||||
/*DOC_START*/
|
||||
/* ConfigFlags */
|
||||
@@ -1229,6 +1319,10 @@ bool luaInit( int argn, const char **argc ) {
|
||||
defineSound();
|
||||
defineMusic();
|
||||
defineLight();
|
||||
defineMaterial();
|
||||
defineMesh();
|
||||
defineModel();
|
||||
defineModelAnimation();
|
||||
/* Define globals. */
|
||||
defineGlobals();
|
||||
|
||||
@@ -1769,7 +1863,6 @@ void luaRegister() {
|
||||
assingGlobalFunction( "GenMeshHeightmap", lmodelsGenMeshHeightmap );
|
||||
assingGlobalFunction( "GenMeshCustom", lmodelsGenMeshCustom );
|
||||
assingGlobalFunction( "UpdateMesh", lmodelsUpdateMesh );
|
||||
assingGlobalFunction( "UnloadMesh", lmodelsUnloadMesh );
|
||||
assingGlobalFunction( "DrawMesh", lmodelsDrawMesh );
|
||||
assingGlobalFunction( "DrawMeshInstanced", lmodelsDrawMeshInstanced );
|
||||
assingGlobalFunction( "SetMeshColor", lmodelsSetMeshColor );
|
||||
@@ -1779,7 +1872,6 @@ void luaRegister() {
|
||||
/* Material. */
|
||||
assingGlobalFunction( "LoadMaterialDefault", lmodelsLoadMaterialDefault );
|
||||
assingGlobalFunction( "CreateMaterial", lmodelsCreateMaterial );
|
||||
assingGlobalFunction( "UnloadMaterial", lmodelsUnloadMaterial );
|
||||
assingGlobalFunction( "SetMaterialTexture", lmodelsSetMaterialTexture );
|
||||
assingGlobalFunction( "SetMaterialColor", lmodelsSetMaterialColor );
|
||||
assingGlobalFunction( "SetMaterialValue", lmodelsSetMaterialValue );
|
||||
@@ -1793,7 +1885,6 @@ void luaRegister() {
|
||||
/* Model. */
|
||||
assingGlobalFunction( "LoadModel", lmodelsLoadModel );
|
||||
assingGlobalFunction( "LoadModelFromMesh", lmodelsLoadModelFromMesh );
|
||||
assingGlobalFunction( "UnloadModel", lmodelsUnloadModel );
|
||||
assingGlobalFunction( "DrawModel", lmodelsDrawModel );
|
||||
assingGlobalFunction( "DrawModelEx", lmodelsDrawModelEx );
|
||||
assingGlobalFunction( "SetModelMaterial", lmodelsSetModelMaterial );
|
||||
@@ -1806,7 +1897,6 @@ void luaRegister() {
|
||||
/* Animations. */
|
||||
assingGlobalFunction( "LoadModelAnimations", lmodelsLoadModelAnimations );
|
||||
assingGlobalFunction( "UpdateModelAnimation", lmodelsUpdateModelAnimation );
|
||||
assingGlobalFunction( "UnloadModelAnimations", lmodelsUnloadModelAnimations );
|
||||
assingGlobalFunction( "IsModelAnimationValid", lmodelsIsModelAnimationValid );
|
||||
assingGlobalFunction( "GetModelAnimationBoneCount", lmodelsGetModelAnimationBoneCount );
|
||||
assingGlobalFunction( "GetModelAnimationFrameCount", lmodelsGetModelAnimationFrameCount );
|
||||
@@ -2988,6 +3078,30 @@ void uluaPushLight( lua_State *L, Light light ) {
|
||||
luaL_setmetatable( L, "Light" );
|
||||
}
|
||||
|
||||
void uluaPushMaterial( lua_State *L, Material material ) {
|
||||
Material *materialP = lua_newuserdata( L, sizeof( Material ) );
|
||||
*materialP = material;
|
||||
luaL_setmetatable( L, "Material" );
|
||||
}
|
||||
|
||||
void uluaPushMesh( lua_State *L, Mesh mesh ) {
|
||||
Mesh *meshP = lua_newuserdata( L, sizeof( Mesh ) );
|
||||
*meshP = mesh;
|
||||
luaL_setmetatable( L, "Mesh" );
|
||||
}
|
||||
|
||||
void uluaPushModel( lua_State *L, Model model ) {
|
||||
Model *modelP = lua_newuserdata( L, sizeof( Model ) );
|
||||
*modelP = model;
|
||||
luaL_setmetatable( L, "Model" );
|
||||
}
|
||||
|
||||
void uluaPushModelAnimation( lua_State *L, ModelAnimation modelAnimation ) {
|
||||
ModelAnimation *modelAnimationP = lua_newuserdata( L, sizeof( ModelAnimation ) );
|
||||
*modelAnimationP = modelAnimation;
|
||||
luaL_setmetatable( L, "ModelAnimation" );
|
||||
}
|
||||
|
||||
int uluaGetTableLen( lua_State *L ) {
|
||||
return uluaGetTableLenIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
1514
src/models.c
1514
src/models.c
File diff suppressed because it is too large
Load Diff
63
src/state.c
63
src/state.c
@@ -17,37 +17,8 @@ bool stateInit( int argn, const char **argc, const char *exePath ) {
|
||||
state->resolution = (Vector2){ 800, 600 };
|
||||
state->luaState = NULL;
|
||||
state->logLevelInvalid = LOG_ERROR;
|
||||
/* Meshes. */
|
||||
state->meshAlloc = ALLOC_PAGE_SIZE;
|
||||
state->meshCount = 0;
|
||||
state->meshes = malloc( state->meshAlloc * sizeof( Mesh* ) );
|
||||
/* Materials. */
|
||||
state->materialAlloc = ALLOC_PAGE_SIZE;
|
||||
state->materialCount = 1;
|
||||
state->materials = malloc( state->materialAlloc * sizeof( Material* ) );
|
||||
/* Models. */
|
||||
state->modelAlloc = ALLOC_PAGE_SIZE;
|
||||
state->modelCount = 0;
|
||||
state->models = malloc( state->modelAlloc * sizeof( Model* ) );
|
||||
/* ModelsAnimations. */
|
||||
state->animationAlloc = ALLOC_PAGE_SIZE;
|
||||
state->animationCount = 0;
|
||||
state->animations = malloc( state->animationAlloc * sizeof( ModelAnimations* ) );
|
||||
|
||||
for ( int i = 0; i < ALLOC_PAGE_SIZE; i++ ) {
|
||||
state->meshes[i] = NULL;
|
||||
state->models[i] = NULL;
|
||||
state->animations[i] = NULL;
|
||||
|
||||
/* The ones we want to save the first. */
|
||||
if ( 0 < i ) {
|
||||
state->materials[i] = NULL;
|
||||
}
|
||||
}
|
||||
InitWindow( state->resolution.x, state->resolution.y, "ReiLua" );
|
||||
/* Has to be after InitWindod where opengl context is created. */
|
||||
state->materials[0] = malloc( sizeof( Material ) );
|
||||
*state->materials[0] = LoadMaterialDefault();
|
||||
|
||||
if ( !IsWindowReady() ) {
|
||||
state->hasWindow = false;
|
||||
@@ -67,36 +38,6 @@ void stateInitInterpret( int argn, const char **argc ) {
|
||||
}
|
||||
|
||||
void stateFree() {
|
||||
for ( int i = 0; i < state->modelCount; ++i ) {
|
||||
if ( state->models[i] != NULL ) {
|
||||
//TODO Test if UnloadModel causes segfaults on exit.
|
||||
UnloadModelKeepMeshes( *state->models[i] );
|
||||
// UnloadModel( *state->models[i] );
|
||||
free( state->models[i] );
|
||||
}
|
||||
}
|
||||
for ( int i = 0; i < state->meshCount; ++i ) {
|
||||
if ( state->meshes[i] != NULL ) {
|
||||
UnloadMesh( *state->meshes[i] );
|
||||
free( state->meshes[i] );
|
||||
}
|
||||
}
|
||||
for ( int i = 0; i < state->materialCount; ++i ) {
|
||||
if ( state->materials[i] != NULL ) {
|
||||
/* Prevent unloading shader that would result in double free when freeing shaders. */
|
||||
state->materials[i]->shader.id = rlGetShaderIdDefault();
|
||||
|
||||
UnloadMaterial( *state->materials[i] );
|
||||
free( state->materials[i] );
|
||||
}
|
||||
}
|
||||
for ( int i = 0; i < state->animationCount; ++i ) {
|
||||
if ( state->animations[i] != NULL ) {
|
||||
UnloadModelAnimations( state->animations[i]->animations, state->animations[i]->animCount );
|
||||
free( state->animations[i] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsAudioDeviceReady() ) {
|
||||
CloseAudioDevice();
|
||||
}
|
||||
@@ -107,10 +48,6 @@ void stateFree() {
|
||||
if ( state->hasWindow ) {
|
||||
CloseWindow();
|
||||
}
|
||||
free( state->meshes );
|
||||
free( state->materials );
|
||||
free( state->models );
|
||||
free( state->animations );
|
||||
free( state->exePath );
|
||||
free( state );
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ int ltextLoadFont( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> font = RL.LoadFontEx( string fileName, int fontSize, int fontChars{} )
|
||||
> font = RL.LoadFontEx( string fileName, int fontSize, int{} fontChars )
|
||||
|
||||
Load font from file with extended parameters. Loading the default character set
|
||||
|
||||
|
||||
@@ -831,35 +831,21 @@ int ltexturesImageDraw( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> success = RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )
|
||||
> RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )
|
||||
|
||||
Draw text ( Custom sprite font ) within an image ( Destination )
|
||||
|
||||
- Failure return false
|
||||
- Success return true
|
||||
Draw text (Custom sprite font) within an image (Destination)
|
||||
*/
|
||||
int ltexturesImageDrawTextEx( lua_State *L ) {
|
||||
// if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !lua_isstring( L, 3 ) || !lua_istable( L, 4 )
|
||||
// || !lua_isnumber( L, 5 ) || !lua_isnumber( L, 6 ) || !lua_istable( L, 7 ) ) {
|
||||
// TraceLog( state->logLevelInvalid, "%s", "Bad call of function. RL.ImageDrawTextEx( Image dst, Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )" );
|
||||
// lua_pushboolean( L, false );
|
||||
// return 1;
|
||||
// }
|
||||
// size_t imageId = lua_tointeger( L, 1 );
|
||||
// size_t fontId = lua_tointeger( L, 2 );
|
||||
// Vector2 position = uluaGetVector2Index( L, 4 );
|
||||
// float fontSize = lua_tonumber( L, 5 );
|
||||
// float spacing = lua_tonumber( L, 6 );
|
||||
// Color tint = uluaGetColorIndex( L, 7 );
|
||||
Image *image = luaL_checkudata( L, 1, "Image" );
|
||||
Font *font = luaL_checkudata( L, 2, "Font" );
|
||||
Vector2 position = uluaGetVector2Index( L, 4 );
|
||||
float fontSize = luaL_checknumber( L, 5 );
|
||||
float spacing = luaL_checknumber( L, 6 );
|
||||
Color tint = uluaGetColorIndex( L, 7 );
|
||||
|
||||
// if ( !validImage( imageId ) || !validFont( fontId ) ) {
|
||||
// lua_pushboolean( L, false );
|
||||
// return 1;
|
||||
// }
|
||||
// ImageDrawTextEx( state->images[ imageId ], *state->fonts[ fontId ], lua_tostring( L, 3 ), position, fontSize, spacing, tint );
|
||||
// lua_pushboolean( L, true );
|
||||
ImageDrawTextEx( image, *font, luaL_checkstring( L, 3 ), position, fontSize, spacing, tint );
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user