Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed Examples/3D modeller/Modeller3D
Binary file not shown.
15 changes: 8 additions & 7 deletions Examples/3D modeller/assets/shaders/fs1.glsl
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//precision highp float; // Set the default precision to medium
#version 310 es
precision mediump float; // Set the default precision to medium

uniform sampler2D u_Texture; // texture
varying vec2 v_UV; // Texture UV coordinate
varying vec4 v_diffuseColour; // Diffuse colour
varying vec4 v_fogColour; // Fog colour

in vec2 v_UV; // Texture UV coordi_nate
in vec4 v_diffuseColour; // Diffuse colour
in vec4 v_fogColour; // Fog colour
out vec4 FragColor;
void main()
{
vec4 col = texture2D(u_Texture, v_UV) * v_diffuseColour + v_fogColour;
if (col.a > 0.01) gl_FragColor = col; else discard;
vec4 col = texture(u_Texture, v_UV) * v_diffuseColour + v_fogColour;
if (col.a > 0.01) FragColor = col; else discard;
}
35 changes: 18 additions & 17 deletions Examples/3D modeller/assets/shaders/vs1.glsl
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//precision highp float; // Set the default precision to medium. We don't need as high of a
#version 310 es
precision mediump float; // Set the default precision to medium

uniform mat4 u_ProjMatrix; // view/projection matrix.
uniform mat4 u_ModelMatrix; // model matrix.
uniform vec3 u_LightPos; // The position of the light in eye space.
uniform vec4 u_lightColour; // The colour of light in eye space.
uniform int u_illuminationModel; // If ==2 then apply illumation model
uniform vec3 u_LightPos; // The position of the light i_n eye space.
uniform vec4 u_lightColour; // The colour of light i_n eye space.
uniform int u_illumi_nationModel; // If ==2 then apply illumation model
uniform int u_reflective; //

uniform vec2 u_animoffset;
Expand All @@ -15,17 +16,17 @@ uniform vec4 u_specularColour;

uniform vec3 u_fogColour;
uniform float u_fogMaxDist;
uniform float u_fogRange; // effectively 1.0 / (fogMaxDist-fogMinDist)
uniform float u_col32; // a floating point representing RGB
uniform float u_fogRange; // effectively 1.0 / (fogMaxDist-fogM_i_nDist)
uniform float u_col32; // a floating poi_nt representi_ng RGB

attribute vec3 a_Position;
attribute vec3 a_Normal;
attribute vec2 a_UV;
attribute float a_Colour;
in vec3 a_Position;
in vec3 a_Normal;
in vec2 a_UV;
in float a_Colour;

varying vec2 v_UV;
varying vec4 v_diffuseColour;
varying vec4 v_fogColour;
out vec2 v_UV;
out vec4 v_diffuseColour;
out vec4 v_fogColour;
//varying vec3 v_Normal;
///varying vec3 v_LightPos;

Expand All @@ -49,16 +50,16 @@ void main()
vec4 emitColour = max(u_lightColour, u_emissiveColour);
float fogFactor = (Position.z + u_fogMaxDist) * u_fogRange; // / (fogMaxDist-fogMinDist)
fogFactor = clamp(fogFactor, 0.0, 1.0);
//if (u_illuminationModel == 1) fogFactor = 1.0;
//if (u_illumi_nationModel == 1) fogFactor = 1.0;
v_fogColour = vec4((u_fogColour * (1.0 - fogFactor)),0.0) * u_lightColour;

// Calc lighting and specular and mix into fogColour
vec4 ambcol = u_ambientColour; //vec4(0,0,0,0);
//vec4 diffuseCol = vec4(u_diffuseColour.rgb * max(u_lightColour.rgb, u_emissiveColour.rgb*(1.0-fogFactor)), u_diffuseColour.a);
vec4 diffuseCol = u_diffuseColour * emitColour * col;
vec4 diffuseCol = vec4(u_diffuseColour.rgb * max(u_lightColour.rgb, u_emissiveColour.rgb*(1.0-fogFactor)), u_diffuseColour.a);
//vec4 diffuseCol = u_diffuseColour * emitColour * col;

// apply shade and fog ...
if (u_illuminationModel == 2) {
if (u_illumi_nationModel == 2) {
float rDotV = max(dot(Normal, lightVector), 0.3); //0.1
fogFactor = fogFactor * rDotV;
//rDotV = max(0.0, dot(lightVector, Normal));
Expand Down
4 changes: 2 additions & 2 deletions Examples/3D modeller/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TARGET = Modeller3D

CC = g++
CFLAGS = -std=c++17 -Wall -Wno-switch
LDLIBS = -lGL -lSDL2_image -lSDL2_mixer -lSDL2_ttf
LDLIBS = -lGLESv2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf
LDFLAGS = $(shell sdl2-config --cflags --libs)

SHARED_DIR:= ../../SharedCode/core
Expand All @@ -26,7 +26,7 @@ CPATH = $(GLTF_DIR)

BUILDPATH = ../../../_build/Projects/$(TARGET)/

GLES_DIR = /opt/vc/include
GLES_DIR = /usr/include
CPATH = $(GLES_DIR)

SRC_DIR:= $(SHARED_DIR) $(FILE_DIR) $(UI_DIR) $(HELPS_DIR) $(EDIT_DIR) $(TESS_DIR) $(GLES_DIR) $(RJSON_DIR) $(FBX_DIR) $(GLTF_DIR) Source
Expand Down
Binary file removed Examples/Blocks/Blocks
Binary file not shown.
6 changes: 3 additions & 3 deletions Examples/Blocks/assets/shaders/vs1.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ uniform mat4 u_ProjMatrix; // view/projection matrix.
uniform mat4 u_ModelMatrix; // model matrix.
uniform vec3 u_LightPos; // The position of the light in eye space.
uniform vec4 u_lightColour; // The colour of light in eye space.
uniform int u_illuminationModel; // If ==2 then apply illumation model
uniform int u_illumi_nationModel; // If ==2 then apply illumation model
uniform int u_reflective; //

uniform vec2 u_animoffset;
Expand Down Expand Up @@ -49,7 +49,7 @@ void main()
vec4 emitColour = max(u_lightColour, u_emissiveColour);
float fogFactor = (Position.z + u_fogMaxDist) * u_fogRange; // / (fogMaxDist-fogMinDist)
fogFactor = clamp(fogFactor, 0.0, 1.0);
//if (u_illuminationModel == 1) fogFactor = 1.0;
//if (u_illumi_nationModel == 1) fogFactor = 1.0;
v_fogColour = vec4((u_fogColour * (1.0 - fogFactor)),0.0) * u_lightColour;

// Calc lighting and specular and mix into fogColour
Expand All @@ -58,7 +58,7 @@ void main()
vec4 diffuseCol = u_diffuseColour * emitColour * col;

// apply shade and fog ...
if (u_illuminationModel == 2) {
if (u_illumi_nationModel == 2) {
float rDotV = max(dot(Normal, lightVector), 0.1);
fogFactor = fogFactor * rDotV;
//rDotV = max(0.0, dot(lightVector, Normal));
Expand Down
4 changes: 2 additions & 2 deletions Examples/Blocks/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TARGET = Blocks

CC = g++
CFLAGS = -std=c++17 -Wall
LDLIBS = -lGL -lGLU -lSDL2_image -lSDL2_mixer -lSDL2_ttf
LDLIBS = -lGLESv2 -lGLU -lSDL2_image -lSDL2_mixer -lSDL2_ttf
LDFLAGS = $(shell sdl2-config --cflags --libs)

SHARED_DIR:= ../../SharedCode/core
Expand All @@ -26,7 +26,7 @@ CPATH = $(GLTF_DIR)

BUILDPATH = ../../../_build/Projects/$(TARGET)/

GLES_DIR = /opt/vc/include
GLES_DIR = /usr/include
CPATH = $(GLES_DIR)

SRC_DIR:= $(RJSON_DIR) $(SHARED_DIR) $(FILE_DIR) $(UI_DIR) $(HELPS_DIR) $(EDIT_DIR) $(TESS_DIR) $(GLES_DIR) $(FBX_DIR) $(GLTF_DIR) source
Expand Down
Binary file removed Examples/CastleCreator/CastleCreator
Binary file not shown.
17 changes: 11 additions & 6 deletions Examples/CastleCreator/assets/shaders/fs1.glsl
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
//precision highp float; // Set the default precision to medium
#version 310 es
precision highp float; // Set the default precision to medium
//Note high precision is needed to NVidia RTX2060 card

uniform sampler2D u_Texture; // texture
varying vec2 v_UV; // Texture UV coordinate
varying vec4 v_diffuseColour; // Diffuse colour
varying vec4 v_fogColour; // Fog colour
in vec2 v_UV; // Texture UV coordinate (i_nterpolated)
in vec4 v_diffuseColour; // Diffuse colour (i_nterpolated)
in vec4 v_fogColour; // Fog colour (i_nterpolated)



out vec4 FragColor;

void main()
{
vec4 col = texture2D(u_Texture, v_UV) * v_diffuseColour + v_fogColour;
if (col.a > 0.01) gl_FragColor = col; else discard;
vec4 col1 = texture(u_Texture, v_UV) * v_diffuseColour + v_fogColour;
if (col1.a > 0.01) FragColor = col1; else discard;
}
29 changes: 16 additions & 13 deletions Examples/CastleCreator/assets/shaders/vs1.glsl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//precision highp float; // Set the default precision to medium. We don't need as high of a
#version 310 es
precision highp float; // Set the default precision to medium. We don't need as high of a
//Note high precision is needed to NVidia RTX2060 card

uniform mat4 u_ProjMatrix; // view/projection matrix.
uniform mat4 u_ModelMatrix; // model matrix.
uniform vec3 u_LightPos; // The position of the light in eye space.
uniform vec4 u_lightColour; // The colour of light in eye space.
uniform int u_illuminationModel; // If ==2 then apply illumation model
uniform vec3 u_LightPos; // The position of the light i_n eye space.
uniform vec4 u_lightColour; // The colour of light i_n eye space.
uniform int u_illumi_nationModel; // If ==2 then apply illumation model
uniform int u_reflective; //

uniform vec2 u_animoffset;
Expand All @@ -16,15 +17,17 @@ uniform vec4 u_specularColour;

uniform vec3 u_fogColour;
uniform float u_fogMaxDist;
uniform float u_fogRange; // effectively 1.0 / (fogMaxDist-fogMinDist)
uniform float u_fogRange; // effectively 1.0 / (fogMaxDist-fogMi_nDist)

attribute vec3 a_Position;
attribute vec3 a_Normal;
attribute vec2 a_UV;

//these may need fixed
in vec3 a_Position;// i_nput vertex position from mesh
in vec3 a_Normal;// i_nput vertex normal from mesh
in vec2 a_UV;// (texcoord) i_nput vertex texture coordi_nate from mesh

varying vec2 v_UV;
varying vec4 v_diffuseColour;
varying vec4 v_fogColour;
out vec2 v_UV;// (texcoord) output texture coordi_nate of vertex
out vec4 v_diffuseColour;//
out vec4 v_fogColour;//
//varying vec3 v_Normal;
///varying vec3 v_LightPos;

Expand All @@ -46,7 +49,7 @@ void main()
vec4 emitColour = max(u_lightColour, u_emissiveColour);
float fogFactor = (Position.z + u_fogMaxDist) * u_fogRange; // / (fogMaxDist-fogMinDist)
fogFactor = clamp(fogFactor, 0.0, 1.0);
//if (u_illuminationModel == 1) fogFactor = 1.0;
//if (u_illumi_nationModel == 1) fogFactor = 1.0;
v_fogColour = vec4((u_fogColour * (1.0 - fogFactor)),0.0) * u_lightColour;

// Calc lighting and specular and mix into fogColour
Expand All @@ -55,7 +58,7 @@ void main()
vec4 diffuseCol = u_diffuseColour * emitColour;

// apply shade and fog ...
if (u_illuminationModel == 2) {
if (u_illumi_nationModel == 2) {
float rDotV = max(dot(Normal, lightVector), 0.1);
fogFactor = fogFactor * rDotV;
//rDotV = max(0.0, dot(lightVector, Normal));
Expand Down
30 changes: 26 additions & 4 deletions Examples/CastleCreator/makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
TARGET = CastleCreator
UNAME := $(shell uname)
CFLAGS =
LDLIBS =
ifeq ($(UNAME), Linux)
TARGET = CastleCreator.app
UNAME_M := $(shell uname -m)
ifneq ($(filter %86,$(UNAME_M)),)
LDLIBS += -lGL
CFLAGS += -DPI3COPENGL
else
LDLIBS += -lGLESv2
CFLAGS += -DPI3COPENGLES
endif
else
TARGET = CastleCreator.exe
LDLIBS += -lGL
CFLAGS += -DPI3COPENGL
endif




#TARGET = CastleCreator

CC = g++
CFLAGS = -std=c++17 -Wall
LDLIBS = -lGL -lSDL2_image -lSDL2_mixer -lSDL2_ttf
CFLAGS += -std=c++17 -Wall
LDLIBS += -lSDL2_image -lSDL2_mixer -lSDL2_ttf
LDFLAGS = $(shell sdl2-config --cflags --libs)

SHARED_DIR:= ../../SharedCode/core
Expand All @@ -24,7 +46,7 @@ CPATH = $(GLTF_DIR)

BUILDPATH = ../../../_build/Projects/$(TARGET)/

GLES_DIR = /opt/vc/include
GLES_DIR = /usr/include
CPATH = $(GLES_DIR)

SRC_DIR:= $(SHARED_DIR) $(FILE_DIR) $(UI_DIR) $(HELPS_DIR) $(TESS_DIR) $(GLES_DIR) $(RJSON_DIR) $(FBX_DIR) $(GLTF_DIR) Source
Expand Down
Binary file removed Examples/Extruder/Extruder
Binary file not shown.
6 changes: 3 additions & 3 deletions Examples/Extruder/assets/shaders/vs1.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ uniform mat4 u_ProjMatrix; // view/projection matrix.
uniform mat4 u_ModelMatrix; // model matrix.
uniform vec3 u_LightPos; // The position of the light in eye space.
uniform vec4 u_lightColour; // The colour of light in eye space.
uniform int u_illuminationModel; // If ==2 then apply illumation model
uniform int u_illumi_nationModel; // If ==2 then apply illumation model
uniform int u_reflective; //

uniform vec2 u_animoffset;
Expand Down Expand Up @@ -45,7 +45,7 @@ void main()
vec4 emitColour = max(u_lightColour, u_emissiveColour);
float fogFactor = (Position.z + u_fogMaxDist) * u_fogRange; // / (fogMaxDist-fogMinDist)
fogFactor = clamp(fogFactor, 0.0, 1.0);
//if (u_illuminationModel == 1) fogFactor = 1.0;
//if (u_illumi_nationModel == 1) fogFactor = 1.0;
v_fogColour = vec4((u_fogColour * (1.0 - fogFactor)),0.0) * u_lightColour;

// Calc lighting and specular and mix into fogColour
Expand All @@ -54,7 +54,7 @@ void main()
vec4 diffuseCol = u_diffuseColour * emitColour;

// apply shade and fog ...
if (u_illuminationModel == 2) {
if (u_illumi_nationModel == 2) {
float rDotV = max(dot(Normal, lightVector), 0.1);
fogFactor = fogFactor * rDotV;
//rDotV = max(0.0, dot(lightVector, Normal));
Expand Down
10 changes: 7 additions & 3 deletions Examples/Extruder/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ TARGET = Extruder

CC = g++
CFLAGS = -std=c++17 -Wall
LDLIBS = -lGL -lSDL2_image -lSDL2_mixer -lSDL2_ttf
LDLIBS = -lGLESv2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf
LDFLAGS = $(shell sdl2-config --cflags --libs)

SHARED_DIR:= ../../SharedCode/core
Expand All @@ -11,19 +11,23 @@ UI_DIR:= ../../SharedCode/ui
HELPS_DIR:= ../../SharedCode/helpers
TESS_DIR:= ../../SharedCode/glutess
RJSON_DIR:= ../../ThirdParty/rapidjson
FBX_DIR:= ../../ThirdParty/openFBX
GLTF_DIR:= ../../ThirdParty/gltf
CPATH = $(SHARED_DIR)
CPATH = $(FILE_DIR)
CPATH = $(UI_DIR)
CPATH = $(HELPS_DIR)
CPATH = $(TESS_DIR)
CPATH = $(RJSON_DIR)
CPATH = $(FBX_DIR)
CPATH = $(GLTF_DIR)

BUILDPATH = ../../../_build/Projects/$(TARGET)/

GLES_DIR = /opt/vc/include
GLES_DIR = /usr/include
CPATH = $(GLES_DIR)

SRC_DIR:= $(SHARED_DIR) $(FILE_DIR) $(UI_DIR) $(HELPS_DIR) $(TESS_DIR) $(GLES_DIR) $(RJSON_DIR) Source
SRC_DIR:= $(SHARED_DIR) $(FILE_DIR) $(UI_DIR) $(HELPS_DIR) $(TESS_DIR) $(GLES_DIR) $(RJSON_DIR) $(FBX_DIR) $(GLTF_DIR) Source
BUILD_DIR:= $(addprefix $(BUILDPATH),$(SRC_DIR))

SRC:= $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.cpp $(sdir)/*.c))
Expand Down
13 changes: 7 additions & 6 deletions Examples/HelloWorld/assets/shaders/fs1.glsl
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//precision highp float; // Set the default precision to medium
#version 310 es
precision highp float;

uniform sampler2D u_Texture; // texture
varying vec2 v_UV; // Texture UV coordinate
varying vec4 v_diffuseColour; // Diffuse colour
varying vec4 v_fogColour; // Fog colour

in vec2 v_UV; // Texture UV coordi_nate
in vec4 v_diffuseColour; // Diffuse colour
in vec4 v_fogColour; // Fog colour
out vec4 FragColor;
void main()
{
vec4 col = texture2D(u_Texture, v_UV) * v_diffuseColour + v_fogColour;
if (col.a > 0.01) gl_FragColor = col; else discard;
if (col.a > 0.01) FragColor = col; else discard;
}
Loading