Fixed build on OSX.

This commit is contained in:
Relintai 2024-01-18 22:03:12 +01:00
parent 6f8fb60fd4
commit d019bb0094
16 changed files with 232 additions and 20 deletions

View File

@ -23,7 +23,7 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS))
# The -MMD and -MP flags together generate Makefiles for us! # The -MMD and -MP flags together generate Makefiles for us!
# These files will have .d instead of .o as the output. # These files will have .d instead of .o as the output.
CPPFLAGS := $(INC_FLAGS) -MMD -MP -D_REENTRANT -Wall CPPFLAGS := $(INC_FLAGS) -MMD -MP -D_REENTRANT -Wall -std=c++14
LDFLAGS := -lm -ldl -lpthread -lX11 -Wall LDFLAGS := -lm -ldl -lpthread -lX11 -Wall

149
compile_osx.sh Executable file
View File

@ -0,0 +1,149 @@
#clang++ main.cpp -Wall -o3 -o ./bin/game -Ilibs/SDL2-linux/include -Llibs/SDL2-linux/lib -lSDL2 -lSDL2main
#g++ main.cpp -Wall -o3 -o ./bin/game -Ilibs/SDL2-linux/include -Llibs/SDL2-linux/lib -lSDL2 -lSDL2main
#g++ main.cpp shader.cpp material.cpp mesh.cpp mesh_instance.cpp mesh_utils.cpp texture.cpp camera.cpp render_core.cpp scene.cpp game_scene.cpp object_2d.cpp tile_map.cpp sprite.cpp \
# -g -Wall -o3 -o ./bin/game $(pkg-config --cflags --libs sdl2 glew)
#g++ -Wall -fexceptions -I/usr/include/SDL2 -D_REENTRANT -g -Isfw -c sfw/core/aabb.cpp -o sfw/core/aabb.o
export SDKROOT=$(xcrun --show-sdk-path)
export args="-std=c++14 -w -framework cocoa -framework iokit -framework CoreFoundation -framework CoreAudio -framework AudioToolbox "
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/aabb.cpp -o sfw/core/aabb.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/basis.cpp -o sfw/core/basis.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/color.cpp -o sfw/core/color.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/face3.cpp -o sfw/core/face3.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/logger.cpp -o sfw/core/logger.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/math_funcs.cpp -o sfw/core/math_funcs.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/memory.cpp -o sfw/core/memory.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/pcg.cpp -o sfw/core/pcg.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/plane.cpp -o sfw/core/plane.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/projection.cpp -o sfw/core/projection.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/quaternion.cpp -o sfw/core/quaternion.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/random_pcg.cpp -o sfw/core/random_pcg.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/rect2.cpp -o sfw/core/rect2.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/rect2i.cpp -o sfw/core/rect2i.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/safe_refcount.cpp -o sfw/core/safe_refcount.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/transform_2d.cpp -o sfw/core/transform_2d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/transform.cpp -o sfw/core/transform.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/ustring.cpp -o sfw/core/ustring.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/string_name.cpp -o sfw/core/string_name.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/vector2.cpp -o sfw/core/vector2.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/vector2i.cpp -o sfw/core/vector2i.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/vector3.cpp -o sfw/core/vector3.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/vector3i.cpp -o sfw/core/vector3i.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/vector4.cpp -o sfw/core/vector4.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/vector4i.cpp -o sfw/core/vector4i.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/file_access.cpp -o sfw/core/file_access.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/dir_access.cpp -o sfw/core/dir_access.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/pool_vector.cpp -o sfw/core/pool_vector.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/pool_allocator.cpp -o sfw/core/pool_allocator.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/mutex.cpp -o sfw/core/mutex.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/sfw_time.cpp -o sfw/core/sfw_time.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/thread.cpp -o sfw/core/thread.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/socket.cpp -o sfw/core/socket.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/inet_address.cpp -o sfw/core/inet_address.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/core/sfw_core.cpp -o sfw/core/sfw_core.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/object.cpp -o sfw/object/object.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/reference.cpp -o sfw/object/reference.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/core_string_names.cpp -o sfw/object/core_string_names.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/variant.cpp -o sfw/object/variant.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/variant_op.cpp -o sfw/object/variant_op.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/psignal.cpp -o sfw/object/psignal.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/array.cpp -o sfw/object/array.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/dictionary.cpp -o sfw/object/dictionary.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/ref_ptr.cpp -o sfw/object/ref_ptr.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/object/resource.cpp -o sfw/object/resource.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/application.cpp -o sfw/render_core/application.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/scene.cpp -o sfw/render_core/scene.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/app_window.cpp -o sfw/render_core/app_window.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/shader.cpp -o sfw/render_core/shader.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/material.cpp -o sfw/render_core/material.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/mesh.cpp -o sfw/render_core/mesh.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/mesh_utils.cpp -o sfw/render_core/mesh_utils.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/texture.cpp -o sfw/render_core/texture.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/image.cpp -o sfw/render_core/image.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/render_state.cpp -o sfw/render_core/render_state.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/keyboard.cpp -o sfw/render_core/keyboard.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/input_event.cpp -o sfw/render_core/input_event.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/input_map.cpp -o sfw/render_core/input_map.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/input.cpp -o sfw/render_core/input.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/shortcut.cpp -o sfw/render_core/shortcut.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/font.cpp -o sfw/render_core/font.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/color_material_2d.cpp -o sfw/render_core/color_material_2d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/color_material.cpp -o sfw/render_core/color_material.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/colored_material.cpp -o sfw/render_core/colored_material.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/font_material.cpp -o sfw/render_core/font_material.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/texture_material_2d.cpp -o sfw/render_core/texture_material_2d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/texture_material.cpp -o sfw/render_core/texture_material.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_core/transparent_texture_material.cpp -o sfw/render_core/transparent_texture_material.o
clang++ -w -framework cocoa -framework iokit -framework CoreFoundation -framework CoreAudio -framework AudioToolbox -D_REENTRANT -g -Isfw -c sfw/render_core/glfw_impl.m -o sfw/render_core/glfw_impl.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_immediate/renderer.cpp -o sfw/render_immediate/renderer.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/camera_3d.cpp -o sfw/render_objects/camera_3d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/object_3d.cpp -o sfw/render_objects/object_3d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/mesh_instance_3d.cpp -o sfw/render_objects/mesh_instance_3d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/camera_2d.cpp -o sfw/render_objects/camera_2d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/mesh_instance_2d.cpp -o sfw/render_objects/mesh_instance_2d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/object_2d.cpp -o sfw/render_objects/object_2d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/sprite.cpp -o sfw/render_objects/sprite.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/tile_map.cpp -o sfw/render_objects/tile_map.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/render_objects/text_2d.cpp -o sfw/render_objects/text_2d.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/game_scene.cpp -o sfw/game_scene.o
clang++ $args -D_REENTRANT -g -Isfw -c sfw/main.cpp -o sfw/main.o
# You might need to add -lpthread and/or -latomic depending on your compiler version
clang++ $args -D_REENTRANT -g sfw/core/aabb.o sfw/core/basis.o sfw/core/color.o \
sfw/core/face3.o sfw/core/logger.o sfw/core/math_funcs.o \
sfw/core/memory.o sfw/core/pcg.o sfw/core/plane.o sfw/core/projection.o sfw/core/quaternion.o sfw/core/random_pcg.o \
sfw/core/rect2.o sfw/core/rect2i.o sfw/core/safe_refcount.o sfw/core/transform_2d.o sfw/core/transform.o \
sfw/core/ustring.o sfw/core/string_name.o \
sfw/core/vector2.o sfw/core/vector2i.o sfw/core/vector3.o \
sfw/core/vector3i.o sfw/core/vector4.o sfw/core/vector4i.o \
sfw/core/pool_vector.o sfw/core/pool_allocator.o sfw/core/mutex.o sfw/core/sfw_time.o \
sfw/core/dir_access.o sfw/core/file_access.o sfw/core/thread.o \
sfw/core/socket.o sfw/core/inet_address.o \
sfw/core/sfw_core.o \
sfw/object/object.o sfw/object/reference.o sfw/object/core_string_names.o \
sfw/object/variant.o sfw/object/variant_op.o sfw/object/psignal.o \
sfw/object/array.o sfw/object/dictionary.o sfw/object/ref_ptr.o \
sfw/object/resource.o \
sfw/render_core/image.o sfw/render_core/render_state.o \
sfw/render_core/application.o sfw/render_core/scene.o sfw/render_core/app_window.o \
sfw/render_core/shader.o sfw/render_core/material.o sfw/render_core/mesh.o \
sfw/render_core/mesh_utils.o sfw/render_core/texture.o \
sfw/render_core/input_event.o sfw/render_core/input_map.o \
sfw/render_core/input.o sfw/render_core/shortcut.o \
sfw/render_core/keyboard.o sfw/render_core/font.o \
sfw/render_core/color_material_2d.o sfw/render_core/color_material.o \
sfw/render_core/colored_material.o sfw/render_core/font_material.o \
sfw/render_core/texture_material_2d.o sfw/render_core/texture_material.o \
sfw/render_core/transparent_texture_material.o \
sfw/render_core/glfw_impl.o \
sfw/render_immediate/renderer.o \
sfw/render_objects/camera_3d.o sfw/render_objects/object_3d.o sfw/render_objects/mesh_instance_3d.o \
sfw/render_objects/object_2d.o \
sfw/render_objects/sprite.o sfw/render_objects/tile_map.o \
sfw/render_objects/camera_2d.o sfw/render_objects/mesh_instance_2d.o \
sfw/render_objects/text_2d.o \
sfw/game_scene.o sfw/main.o \
-o game
#export args="-lm -ldl -lpthread -lX11 -w -Iengine/ $args"

View File

@ -15,6 +15,11 @@
#if defined(_WIN64) || defined(_WIN32) #if defined(_WIN64) || defined(_WIN32)
struct DirAccessWindowsPrivate; struct DirAccessWindowsPrivate;
#elif defined(__APPLE__)
#include <dirent.h>
#else #else
struct __dirstream; struct __dirstream;
typedef struct __dirstream DIR; typedef struct __dirstream DIR;

View File

@ -19,6 +19,14 @@
// Mingw // Mingw
struct _iobuf; struct _iobuf;
typedef struct _iobuf FILE; typedef struct _iobuf FILE;
#elif defined(__APPLE__)
struct __sFILE;
typedef struct __sFILE FILE;
typedef void (*FileCloseNotificationFunc)(const String &p_file, int p_flags);
#else #else
struct _IO_FILE; struct _IO_FILE;
typedef struct _IO_FILE FILE; typedef struct _IO_FILE FILE;

View File

@ -27,7 +27,7 @@ private:
void operator=(const m_class &p_rval) {} \ void operator=(const m_class &p_rval) {} \
\ \
public: \ public: \
virtual String get_class() const override { \ virtual String get_class() const { \
return String(#m_class); \ return String(#m_class); \
} \ } \
virtual const StringName *_get_class_namev() const { \ virtual const StringName *_get_class_namev() const { \
@ -52,10 +52,10 @@ public:
static String inherits_static() { \ static String inherits_static() { \
return String(#m_inherits); \ return String(#m_inherits); \
} \ } \
virtual bool is_class(const String &p_class) const override { \ virtual bool is_class(const String &p_class) const { \
return (p_class == (#m_class)) ? true : m_inherits::is_class(p_class); \ return (p_class == (#m_class)) ? true : m_inherits::is_class(p_class); \
} \ } \
virtual bool is_class_ptr(void *p_ptr) const override { \ virtual bool is_class_ptr(void *p_ptr) const { \
return (p_ptr == get_class_ptr_static()) ? true : m_inherits::is_class_ptr(p_ptr); \ return (p_ptr == get_class_ptr_static()) ? true : m_inherits::is_class_ptr(p_ptr); \
} \ } \
static void get_valid_parents_static(Vector<String> *p_parents) { \ static void get_valid_parents_static(Vector<String> *p_parents) { \

View File

@ -10964,15 +10964,8 @@ typedef struct _GLFWwindowNull
} }
// Swaps the provided pointers // Swaps the provided pointers
/*
#define _GLFW_SWAP_POINTERS(x, y) \ #ifdef __cplusplus
{ \
void* t; \
t = x; \
x = y; \
y = t; \
}
*/
#define _GLFW_SWAP_POINTERS(m_x, m_y) __glfw_ptr_swap_tmpl((m_x), (m_y)) #define _GLFW_SWAP_POINTERS(m_x, m_y) __glfw_ptr_swap_tmpl((m_x), (m_y))
template <class T> template <class T>
@ -10982,6 +10975,18 @@ inline void __glfw_ptr_swap_tmpl(T &x, T &y) {
y = aux; y = aux;
} }
#else
#define _GLFW_SWAP_POINTERS(x, y) \
{ \
void* t; \
t = x; \
x = y; \
y = t; \
}
#endif
// Per-thread error structure // Per-thread error structure
// //
struct _GLFWerror struct _GLFWerror

View File

@ -4,6 +4,13 @@
//--STRIP //--STRIP
#include "render_core/app_window.h" #include "render_core/app_window.h"
#ifdef __APPLE__
#include "3rd_glfw3.h"
#include "render_core/3rd_glad.h"
#else
#define GLAD_GL_IMPLEMENTATION // glad #define GLAD_GL_IMPLEMENTATION // glad
#include "render_core/3rd_glad.h" #include "render_core/3rd_glad.h"
@ -24,6 +31,8 @@
#undef timeGetTime #undef timeGetTime
#undef Time #undef Time
#endif
#include "core/error_macros.h" #include "core/error_macros.h"
#include "core/sfw_time.h" #include "core/sfw_time.h"
#include "core/ustring.h" #include "core/ustring.h"
@ -175,6 +184,12 @@ void AppWindow::window_hints(unsigned flags) {
//glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330 //glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); // osx, 2:#version150,3:330
//according to the documentation, it must be GLFW_OPENGL_ANY_PROFILE. //according to the documentation, it must be GLFW_OPENGL_ANY_PROFILE.
//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE); //glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
//according to the documentation, it must be GLFW_OPENGL_ANY_PROFILE.
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);
//glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
#elif defined(_WIN64) || defined(_WIN32) #elif defined(_WIN64) || defined(_WIN32)
// Compute shaders need 4.5 otherwise. But... // Compute shaders need 4.5 otherwise. But...
// According to the GLFW docs, the context version hint acts as a minimum version. // According to the GLFW docs, the context version hint acts as a minimum version.
@ -193,13 +208,13 @@ void AppWindow::window_hints(unsigned flags) {
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); //osx //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); //osx
#endif #endif
//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //osx+ems //glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //osx+ems
glfwWindowHint(GLFW_STENCIL_BITS, 8); //osx glfwWindowHint(GLFW_STENCIL_BITS, 8); //osx
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
//glfwWindowHint( GLFW_RED_BITS, 8 ); //glfwWindowHint( GLFW_RED_BITS, 8 );
//glfwWindowHint( GLFW_GREEN_BITS, 8 ); //glfwWindowHint( GLFW_GREEN_BITS, 8 );
//glfwWindowHint( GLFW_BLUE_BITS, 8 ); //glfwWindowHint( GLFW_BLUE_BITS, 8 );
@ -843,7 +858,7 @@ void AppWindow::aspect_unlock() {
if (!_window) { if (!_window) {
return; return;
} }
AppWindow::aspect_lock(0, 0); AppWindow::aspect_lock(0, 0);
} }

View File

@ -37,7 +37,7 @@ const char **ColorMaterial::get_vertex_shader_source() {
const char **ColorMaterial::get_fragment_shader_source() { const char **ColorMaterial::get_fragment_shader_source() {
static const char *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
"precision mediump float;" //"precision mediump float;"
"varying vec4 v_color;\n" "varying vec4 v_color;\n"
"\n" "\n"
"void main() { gl_FragColor = v_color; }\n" "void main() { gl_FragColor = v_color; }\n"

View File

@ -42,8 +42,10 @@ const char **ColorMaterial2D::get_vertex_shader_source() {
const char **ColorMaterial2D::get_fragment_shader_source() { const char **ColorMaterial2D::get_fragment_shader_source() {
static const char *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
#ifndef __APPLE__
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
#endif
"varying vec4 v_color;\n" "varying vec4 v_color;\n"
"\n" "\n"
"void main() {\n" "void main() {\n"

View File

@ -33,8 +33,11 @@ const char **ColoredMaterial::get_vertex_shader_source() {
const char **ColoredMaterial::get_fragment_shader_source() { const char **ColoredMaterial::get_fragment_shader_source() {
static const char *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
#ifndef __APPLE__
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
#endif
"\n"
"uniform vec4 fragment_color;\n" "uniform vec4 fragment_color;\n"
"\n" "\n"
"void main() {\n" "void main() {\n"

View File

@ -52,8 +52,11 @@ const char **FontMaterial::get_vertex_shader_source() {
const char **FontMaterial::get_fragment_shader_source() { const char **FontMaterial::get_fragment_shader_source() {
static const char *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
#ifndef __APPLE__
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
#endif
"\n"
"uniform sampler2D u_texture;\n" "uniform sampler2D u_texture;\n"
"\n" "\n"
"varying vec2 v_uv;\n" "varying vec2 v_uv;\n"

View File

@ -0,0 +1,15 @@
#define GLAD_GL_IMPLEMENTATION // glad
#include "render_core/3rd_glad.h"
#define _GLFW_IMPLEMENTATION // glfw337
#define GLFW_INCLUDE_NONE // glfw337
#define _GLFW_COCOA // glfw osx
#undef _GNU_SOURCE
#include "3rd_glfw3.h"
#undef timeGetTime
#undef Time

View File

@ -53,8 +53,10 @@ const char **TextureMaterial::get_vertex_shader_source() {
const char **TextureMaterial::get_fragment_shader_source() { const char **TextureMaterial::get_fragment_shader_source() {
static const char *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
#ifndef __APPLE__
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
#endif
"uniform sampler2D u_texture;\n" "uniform sampler2D u_texture;\n"
"\n" "\n"
"varying vec2 v_uv;\n" "varying vec2 v_uv;\n"

View File

@ -49,8 +49,11 @@ const char **TextureMaterial2D::get_vertex_shader_source() {
const char **TextureMaterial2D::get_fragment_shader_source() { const char **TextureMaterial2D::get_fragment_shader_source() {
static const char *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
#ifndef __APPLE__
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
#endif
"\n"
"uniform sampler2D u_texture;\n" "uniform sampler2D u_texture;\n"
"\n" "\n"
"varying vec2 v_uv;\n" "varying vec2 v_uv;\n"

View File

@ -49,8 +49,10 @@ const char **TransparentTextureMaterial::get_vertex_shader_source() {
const char **TransparentTextureMaterial::get_fragment_shader_source() { const char **TransparentTextureMaterial::get_fragment_shader_source() {
static const char *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
#ifndef __APPLE__
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
#endif
"uniform sampler2D u_texture;\n" "uniform sampler2D u_texture;\n"
"\n" "\n"
"varying vec2 v_uv;\n" "varying vec2 v_uv;\n"

View File

@ -25,7 +25,7 @@ private:
void operator=(const m_class &p_rval) {} \ void operator=(const m_class &p_rval) {} \
\ \
public: \ public: \
virtual String get_class() const override { \ virtual String get_class() const { \
return String(#m_class); \ return String(#m_class); \
} \ } \
virtual const StringName *_get_class_namev() const { \ virtual const StringName *_get_class_namev() const { \
@ -50,10 +50,10 @@ public:
static String inherits_static() { \ static String inherits_static() { \
return String(#m_inherits); \ return String(#m_inherits); \
} \ } \
virtual bool is_class(const String &p_class) const override { \ virtual bool is_class(const String &p_class) const { \
return (p_class == (#m_class)) ? true : m_inherits::is_class(p_class); \ return (p_class == (#m_class)) ? true : m_inherits::is_class(p_class); \
} \ } \
virtual bool is_class_ptr(void *p_ptr) const override { \ virtual bool is_class_ptr(void *p_ptr) const { \
return (p_ptr == get_class_ptr_static()) ? true : m_inherits::is_class_ptr(p_ptr); \ return (p_ptr == get_class_ptr_static()) ? true : m_inherits::is_class_ptr(p_ptr); \
} \ } \
static void get_valid_parents_static(Vector<String> *p_parents) { \ static void get_valid_parents_static(Vector<String> *p_parents) { \