New object types for Image, Texture, RenderTexture, Camera2D, Camera3D and Shader.

This commit is contained in:
jussi
2023-10-27 22:53:56 +03:00
parent 4cb4edcaf0
commit 7ef87c8e2f
20 changed files with 967 additions and 2904 deletions

View File

@@ -1,8 +1,5 @@
#pragma once
/* Validators. */
bool validCamera3D( size_t id );
bool validShader( size_t id );
/* Window. */
int lcoreIsWindowReady( lua_State *L );
int lcoreIsWindowFullscreen( lua_State *L );
@@ -75,7 +72,6 @@ int lcoreSetShaderValueMatrix( lua_State *L );
int lcoreSetShaderValueTexture( lua_State *L );
int lcoreSetShaderValue( lua_State *L );
int lcoreSetShaderValueV( lua_State *L );
int lcoreUnloadShader( lua_State *L );
/* File. */
int lcoreGetBasePath( lua_State *L );
int lcoreFileExists( lua_State *L );
@@ -97,7 +93,6 @@ int lcoreLoadDroppedFiles( lua_State *L );
int lcoreGetFileModTime( lua_State *L );
/* Camera2D. */
int lcoreCreateCamera2D( lua_State *L );
int lcoreUnloadCamera2D( lua_State *L );
int lcoreBeginMode2D( lua_State *L );
int lcoreEndMode2D( lua_State *L );
int lcoreSetCamera2DTarget( lua_State *L );
@@ -110,7 +105,6 @@ int lcoreGetCamera2DRotation( lua_State *L );
int lcoreGetCamera2DZoom( lua_State *L );
/* Camera3D. */
int lcoreCreateCamera3D( lua_State *L );
int lcoreUnloadCamera3D( lua_State *L );
int lcoreBeginMode3D( lua_State *L );
int lcoreEndMode3D( lua_State *L );
int lcoreSetCamera3DPosition( lua_State *L );

View File

@@ -28,10 +28,6 @@ typedef struct {
int y;
} Buffer;
typedef struct {
int age;
} Kissa;
bool luaInit( int argn, const char **argc );
int luaTraceback( lua_State *L );
bool luaCallMain();
@@ -39,12 +35,8 @@ void luaCallProcess();
void luaCallDraw();
void luaCallExit();
void luaRegister();
/* Type validators. */
bool isValidTexture( lua_State *L, int index, bool allowTable );
bool isValidRenderTexture( lua_State *L, int index, bool allowTable );
bool isValidCamera2D( lua_State *L, int index, bool allowTable );
bool isValidCamera3D( lua_State *L, int index, bool allowTable );
/* Lua Util functions. */
bool uluaGetBoolean( lua_State *L, int index );
Color uluaGetColor( lua_State *L );
Color uluaGetColorIndex( lua_State *L, int index );
Vector2 uluaGetVector2( lua_State *L );
@@ -65,10 +57,6 @@ Ray uluaGetRay( lua_State *L );
Ray uluaGetRayIndex( lua_State *L, int index );
NPatchInfo uluaGetNPatchInfo( lua_State *L );
NPatchInfo uluaGetNPatchInfoIndex( lua_State *L, int index );
Texture uluaGetTexture( lua_State *L, int index );
RenderTexture uluaGetRenderTexture( lua_State *L, int index );
Camera2D uluaGetCamera2D( lua_State *L, int index );
Camera3D uluaGetCamera3D( lua_State *L, int index );
/* Push types. */
void uluaPushColor( lua_State *L, Color color );
void uluaPushVector2( lua_State *L, Vector2 vector );
@@ -80,7 +68,12 @@ void uluaPushMatrix( lua_State *L, Matrix matrix );
void uluaPushRay( lua_State *L, Ray ray );
void uluaPushRayCollision( lua_State *L, RayCollision rayCol );
void uluaPushBoundingBox( lua_State *L, BoundingBox box );
void uluaPushImage( lua_State *L, Image image );
void uluaPushTexture( lua_State *L, Texture texture );
void uluaPushRenderTexture( lua_State *L, RenderTexture renderTexture );
void uluaPushCamera2D( lua_State *L, Camera2D camera );
void uluaPushCamera3D( lua_State *L, Camera3D camera );
void uluaPushShader( lua_State *L, Shader shader );
int uluaGetTableLen( lua_State *L );
int uluaGetTableLenIndex( lua_State *L, int index );

View File

@@ -3,9 +3,9 @@
#define STRING_LEN 1024
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_MINOR 6
#define VERSION_PATCH 0
#define VERSION_DEV 0
#define VERSION_DEV 1
#include "glad.h"
#include <stdio.h>

View File

@@ -7,13 +7,6 @@ typedef struct {
unsigned int animCount;
} ModelAnimations;
typedef struct {
int type;
int texRef; /* TextureReference. */
Texture texture;
RenderTexture renderTexture;
} ReiTexture;
typedef struct {
char *exePath;
bool hasWindow;
@@ -23,14 +16,6 @@ typedef struct {
size_t guiFont;
int logLevelInvalid;
/* Resources. */
/* Images. */
Image **images;
size_t imageCount;
size_t imageAlloc;
/* Textures. */
ReiTexture **textures;
size_t textureCount;
size_t textureAlloc;
/* Fonts. */
Font **fonts;
size_t fontCount;
@@ -47,14 +32,6 @@ typedef struct {
Music **musics;
size_t musicCount;
size_t musicAlloc;
/* Camera2D's. */
Camera2D **camera2Ds;
size_t camera2DCount;
size_t camera2DAlloc;
/* Camera3D's. */
Camera3D **camera3Ds;
size_t camera3DCount;
size_t camera3DAlloc;
/* Meshes. */
Mesh **meshes;
size_t meshCount;
@@ -71,10 +48,6 @@ typedef struct {
ModelAnimations **animations;
size_t animationCount;
size_t animationAlloc;
/* Shaders. */
Shader **shaders;
size_t shaderCount;
size_t shaderAlloc;
/* Lights. */
Light **lights;
size_t lightCount;

View File

@@ -1,19 +1,9 @@
#pragma once
/* TEXTURE_TYPE_ALL is internal and used for accepting every type. */
enum TextureType { TEXTURE_TYPE_TEXTURE, TEXTURE_TYPE_RENDER_TEXTURE, TEXTURE_TYPE_ALL };
/* Validators. */
bool validImage( size_t id );
// bool validTexture( size_t id, int type );
// bool validTexture( lua_State *L, int index );
Texture2D* texturesGetSourceTexture( size_t id );
void texturesFreeTexture( size_t id );
/* Image Loading. */
int ltexturesLoadImage( lua_State *L );
int ltexturesLoadImageFromTexture( lua_State *L );
int ltexturesLoadImageFromScreen( lua_State *L );
int ltexturesUnloadImage( lua_State *L );
int ltexturesExportImage( lua_State *L );
int ltexturesExportImageAsCode( lua_State *L );
/* Image Generation. */
@@ -76,7 +66,6 @@ int ltexturesLoadTexture( lua_State *L );
int ltexturesLoadTextureFromImage( lua_State *L );
int ltexturesLoadTextureCubemap( lua_State *L );
int ltexturesLoadRenderTexture( lua_State *L );
int ltexturesUnloadTexture( lua_State *L );
int ltexturesIsTextureReady( lua_State *L );
int ltexturesUpdateTexture( lua_State *L );
int ltexturesUpdateTextureRec( lua_State *L );
@@ -87,7 +76,6 @@ int ltexturesDrawTexturePro( lua_State *L );
int ltexturesDrawTextureNPatch( lua_State *L );
int ltexturesBeginTextureMode( lua_State *L );
int ltexturesEndTextureMode( lua_State *L );
int ltexturesGetTextureType( lua_State *L );
/* Texture Configuration. */
int ltexturesGenTextureMipmaps( lua_State *L );
int ltexturesSetTextureFilter( lua_State *L );
@@ -96,6 +84,10 @@ int ltexturesGetTextureId( lua_State *L );
int ltexturesGetTextureSize( lua_State *L );
int ltexturesGetTextureMipmaps( lua_State *L );
int ltexturesGetTextureFormat( lua_State *L );
/* RenderTexture Configuration. */
int ltexturesGetRenderTextureId( lua_State *L );
int ltexturesGetRenderTextureTexture( lua_State *L );
int ltexturesGetRenderTextureDepthTexture( lua_State *L );
/* Color/pixel */
int ltexturesFade( lua_State *L );
int ltexturesColorToInt( lua_State *L );