Skip to content

Commit

Permalink
[General] Fixed binidngs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dacode45 committed Jul 25, 2020
1 parent 7dad0a2 commit 177d0e0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
Empty file added bindings_windows.rs
Empty file.
8 changes: 4 additions & 4 deletions raylib-sys/bindings_windows.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen */
/* automatically generated by rust-bindgen 0.54.1 */

pub const __GNUC_VA_LIST: u32 = 1;
pub const PI: f64 = 3.141592653589793;
Expand Down Expand Up @@ -840,9 +840,9 @@ pub const GL_INT_VEC2: u32 = 35667;
pub const GL_INT_VEC3: u32 = 35668;
pub const GL_INT_VEC4: u32 = 35669;
pub const GL_BOOL: u32 = 35670;
pub const GL_boolVEC2: u32 = 35671;
pub const GL_boolVEC3: u32 = 35672;
pub const GL_boolVEC4: u32 = 35673;
pub const GL_BOOL_VEC2: u32 = 35671;
pub const GL_BOOL_VEC3: u32 = 35672;
pub const GL_BOOL_VEC4: u32 = 35673;
pub const GL_FLOAT_MAT2: u32 = 35674;
pub const GL_FLOAT_MAT3: u32 = 35675;
pub const GL_FLOAT_MAT4: u32 = 35676;
Expand Down
4 changes: 2 additions & 2 deletions raylib-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::path::{Path, PathBuf};
use std::{env, fs};

/// latest version on github's release page as of time or writing
const LATEST_RAYLIB_VERSION: &str = "master";
const LATEST_RAYLIB_VERSION: &str = "3.0.0";
const LATEST_RAYLIB_API_VERSION: &str = "3";

#[cfg(feature = "nobuild")]
Expand Down Expand Up @@ -127,7 +127,7 @@ fn gen_bindings() {
fn gen_rgui() {
// Compile the code and link with cc crate
cc::Build::new()
.file("rgui_wrapper.c")
.file("rgui_wrapper.cpp")
.include(".")
.warnings(false)
.extra_warnings(false)
Expand Down
File renamed without changes.
40 changes: 21 additions & 19 deletions raylib-sys/rlights.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,21 @@
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
#define MAX_LIGHTS 4 // Max lights supported by shader
#define LIGHT_DISTANCE 3.5f // Light distance from world center
#define LIGHT_HEIGHT 1.0f // Light height position
#define MAX_LIGHTS 4 // Max lights supported by shader
#define LIGHT_DISTANCE 3.5f // Light distance from world center
#define LIGHT_HEIGHT 1.0f // Light height position

//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
typedef enum {
typedef enum
{
LIGHT_DIRECTIONAL,
LIGHT_POINT
} LightType;

typedef struct {
typedef struct
{
bool enabled;
LightType type;
Vector3 position;
Expand All @@ -64,22 +66,22 @@ typedef struct {
} Light;

#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
extern "C"
{ // Prevents name mangling of functions
#endif

//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
void CreateLight(int type, Vector3 pos, Vector3 targ, Color color, Shader shader); // Defines a light and get locations from PBR shader
void UpdateLightValues(Shader shader, Light light); // Send to PBR shader light values
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
void CreateLight(int type, Vector3 pos, Vector3 targ, Color color, Shader shader); // Defines a light and get locations from PBR shader
void UpdateLightValues(Shader shader, Light light); // Send to PBR shader light values

#ifdef __cplusplus
}
#endif

#endif // RLIGHTS_H


/***********************************************************************************
*
* RLIGHTS IMPLEMENTATION
Expand All @@ -103,8 +105,8 @@ void UpdateLightValues(Shader shader, Light light);
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
static Light lights[MAX_LIGHTS] = { 0 };
static int lightsCount = 0; // Current amount of created lights
static Light lights[MAX_LIGHTS] = {0};
static int lightsCount = 0; // Current amount of created lights

//----------------------------------------------------------------------------------
// Module specific Functions Declaration
Expand All @@ -118,12 +120,12 @@ static int lightsCount = 0; // Current amount of created lights
// Defines a light and get locations from PBR shader
void CreateLight(int type, Vector3 pos, Vector3 targ, Color color, Shader shader)
{
Light light = { 0 };
Light light = {0};

if (lightsCount < MAX_LIGHTS)
{
light.enabled = true;
light.type = type;
light.type = (LightType)type;
light.position = pos;
light.target = targ;
light.color = color;
Expand Down Expand Up @@ -160,15 +162,15 @@ void UpdateLightValues(Shader shader, Light light)
SetShaderValue(shader, light.typeLoc, &light.type, UNIFORM_INT);

// Send to shader light position values
float position[3] = { light.position.x, light.position.y, light.position.z };
float position[3] = {light.position.x, light.position.y, light.position.z};
SetShaderValue(shader, light.posLoc, position, UNIFORM_VEC3);

// Send to shader light target position values
float target[3] = { light.target.x, light.target.y, light.target.z };
float target[3] = {light.target.x, light.target.y, light.target.z};
SetShaderValue(shader, light.targetLoc, target, UNIFORM_VEC3);

// Send to shader light color values
float diff[4] = { (float)light.color.r/(float)255, (float)light.color.g/(float)255, (float)light.color.b/(float)255, (float)light.color.a/(float)255 };
float diff[4] = {(float)light.color.r / (float)255, (float)light.color.g / (float)255, (float)light.color.b / (float)255, (float)light.color.a / (float)255};
SetShaderValue(shader, light.colorLoc, diff, UNIFORM_VEC4);
}

Expand Down

0 comments on commit 177d0e0

Please sign in to comment.