From a2c8ddca1345722603637bddc3421f64025d7e5e Mon Sep 17 00:00:00 2001 From: Palaui Date: Tue, 9 Dec 2014 13:10:28 +0100 Subject: [PATCH] Revert "Corrected some bugs..." This reverts commit 29d8b48503f3064cdc1f3a87c01b4264e716a220. --- src/core.c | 11 +---------- src/makefile | 31 ++++++++----------------------- src/models.c | 2 +- src/raylib.h | 1 - src/raymath.h | 4 ++-- src/rlgl.c | 8 +------- 6 files changed, 13 insertions(+), 44 deletions(-) diff --git a/src/core.c b/src/core.c index 62ab5cbb4..dec08eebd 100644 --- a/src/core.c +++ b/src/core.c @@ -165,7 +165,7 @@ static const char *windowTitle; // Window text title... static char configFlags = 0; static bool customCursor = false; // Tracks if custom cursor has been set -static bool cursorOnScreen = false; // Tracks if cursor is inside client area +static bool cursorOnScreen = true; // Tracks if cursor is inside client area static Texture2D cursor; // Cursor texture static Vector2 mousePosition; @@ -727,15 +727,6 @@ Vector2 GetMousePosition(void) return mousePosition; } -// Set mouse position XY -void SetMousePosition(Vector2 position) -{ - mousePosition = position; -#if defined(PLATFORM_DESKTOP) - glfwSetCursorPos(window, position.x, position.y); -#endif -} - // Returns mouse wheel movement Y int GetMouseWheelMove(void) { diff --git a/src/makefile b/src/makefile index 76984bbe6..bb37748ab 100644 --- a/src/makefile +++ b/src/makefile @@ -24,7 +24,7 @@ #************************************************************************************************** # define raylib platform (by default, compile for RPI) -# Other possible platforms: PLATFORM_DESKTOP_WIN PLATFORM_DESKTOP_LINUX PLATFORM_DESKTOP_MAC PLATFORM_WEB +# Other possible platforms: PLATFORM_DESKTOP PLATFORM_DESKTOP_LINUX PLATFORM ?= PLATFORM_RPI # define raylib graphics api depending on selected platform @@ -40,26 +40,16 @@ endif # NOTE: makefiles targets require tab indentation # define compiler: gcc for C program, define as g++ for C++ -ifeq ($(PLATFORM),PLATFORM_WEB) - # define emscripten compiler - CC = emcc -else - # define default gcc compiler - CC = gcc -endif +CC = gcc # define compiler flags: # -O2 defines optimization level # -Wall turns on most, but not all, compiler warnings # -std=c99 use standard C from 1999 revision -ifeq ($(PLATFORM),PLATFORM_WEB) - CFLAGS = -O3 -s USE_GLFW=3 -s LEGACY_GL_EMULATION=1 -else ifeq ($(PLATFORM),PLATFORM_RPI) CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline else - CFLAGS = -O2 -Wall -std=c99 -endif + CFLAGS = -O2 -Wall -std=c99 -fgnu89-inline endif #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes @@ -79,16 +69,11 @@ default: raylib # compile raylib library raylib: $(OBJS) -ifeq ($(PLATFORM),PLATFORM_WEB) - emcc $(OBJS) -o raylib.bc -else ar rcs libraylib.a $(OBJS) -endif # compile core module -# emcc core.c -o core.bc -DPLATFORM_DESKTOP core.o: core.c - $(CC) -c core.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c core.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) # compile rlgl module rlgl.o: rlgl.c @@ -100,19 +85,19 @@ raymath.o: raymath.c # compile shapes module shapes.o: shapes.c - $(CC) -c shapes.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c shapes.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) # compile textures module textures.o: textures.c - $(CC) -c textures.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c textures.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) # compile text module text.o: text.c - $(CC) -c text.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c text.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) # compile models module models.o: models.c - $(CC) -c models.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) -c models.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) # compile audio module audio.o: audio.c diff --git a/src/models.c b/src/models.c index f59a7b43c..2d2af038c 100644 --- a/src/models.c +++ b/src/models.c @@ -743,7 +743,7 @@ Model LoadHeightmap(Image heightmap, float maxHeight) vData.texcoords[tcCounter + 7] = vData.texcoords[tcCounter + 5]; vData.texcoords[tcCounter + 8] = vData.texcoords[tcCounter + 2]; - vData.texcoords[tcCounter + 9] = vData.texcoords[tcCounter + 3]; + vData.texcoords[tcCounter + 9] = vData.texcoords[tcCounter + 1]; vData.texcoords[tcCounter + 10] = (float)(x+1) / (mapX-1); vData.texcoords[tcCounter + 11] = (float)(z+1) / (mapZ-1); diff --git a/src/raylib.h b/src/raylib.h index e7ef32178..9809d8234 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -340,7 +340,6 @@ bool IsMouseButtonUp(int button); // Detect if a mouse but int GetMouseX(void); // Returns mouse position X int GetMouseY(void); // Returns mouse position Y Vector2 GetMousePosition(void); // Returns mouse position XY -void SetMousePosition(Vector2 position); // Set mouse position XY int GetMouseWheelMove(void); // Returns mouse wheel movement Y bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available diff --git a/src/raymath.h b/src/raymath.h index 334df4f30..c396a347d 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -108,8 +108,8 @@ Matrix MatrixAdd(Matrix left, Matrix right); // Add two matrices Matrix MatrixSubstract(Matrix left, Matrix right); // Substract two matrices (left - right) Matrix MatrixTranslate(float x, float y, float z); // Returns translation matrix Matrix MatrixRotate(float angleX, float angleY, float angleZ); // Returns rotation matrix -Matrix MatrixFromAxisAngle(Vector3 axis, float angle); // Returns rotation matrix for an angle around an specified axis -Matrix MatrixFromAxisAngle2(Vector3 axis, float angle); // Returns rotation matrix for an angle around an specified axis (test another implemntation) +Matrix MatrixRotateAroundAxis(Vector3 axis, float angle); // Returns rotation matrix for an angle around an specified axis +Matrix MatrixRotateAroundAxis2(Vector3 axis, float angle); // Returns rotation matrix for an angle around an specified axis (test another implemntation) Matrix MatrixFromQuaternion(Quaternion q); // Returns rotation matrix for a given quaternion Matrix MatrixRotateX(float angle); // Returns x-rotation matrix (angle in radians) Matrix MatrixRotateY(float angle); // Returns y-rotation matrix (angle in radians) diff --git a/src/rlgl.c b/src/rlgl.c index ad6883e03..5e51b2e2b 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -301,10 +301,6 @@ void rlRotatef(float angleDeg, float x, float y, float z) if (x == 1) rot = MatrixRotateX(angleDeg*DEG2RAD); else if (y == 1) rot = MatrixRotateY(angleDeg*DEG2RAD); else if (z == 1) rot = MatrixRotateZ(angleDeg*DEG2RAD); - - //Vector3 vec = (Vector3){ 0, 0, 1 }; - //VectorNormalize(&vec); - //rot = MatrixFromAxisAngle(vec, angleDeg*DEG2RAD); // Working MatrixTranspose(&rot); @@ -1309,8 +1305,7 @@ unsigned int rlglLoadTexture(unsigned char *data, int width, int height, bool ge #if defined(GRAPHICS_API_OPENGL_33) // NOTE: We define internal (GPU) format as GL_RGBA8 (probably BGRA8 in practice, driver takes care) - //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); // OpenGL - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); // WebGL + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); #elif defined(GRAPHICS_API_OPENGL_ES2) // NOTE: On embedded systems, we let the driver choose the best internal format glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); @@ -1567,7 +1562,6 @@ static GLuint LoadDefaultShaders(void) char fShaderStr[] = " #version 110 \n" // NOTE: Equivalent to version 100 on ES2 #elif defined(GRAPHICS_API_OPENGL_ES2) char fShaderStr[] = " #version 100 \n" // NOTE: Must be defined this way! 110 doesn't work! - "precision mediump float; \n" // WebGL, required for PLATFORM_WEB #endif "uniform sampler2D texture0; \n" "varying vec2 fragTexCoord; \n"