Commit 6ff786b1 authored by David Llewellyn-Jones's avatar David Llewellyn-Jones

Add datadir command line option

Snap packages install to $(datadir), but run from a different
location. Consequently, compiling the data directory into
the code (through a config define) doesn't work. See
https://bugs.launchpad.net/ubuntu/+source/snapcraft/+bug/1583250
This change allows the data directory to be configured at
runtime as a command line parameter, to help allow a snap
package to be created.
parent 65f935b3
bin_PROGRAMS = ../functy
___functy_SOURCES = function.c function.h function_private.h functy.c functy.h textures.c textures.h utils.c utils.h vis.c vis.h filesave.c filesave.h cartesian.c cartesian.h spherical.c spherical.h shader.c shader.h curve.c curve.h vecsym.c vecsym.h exportply.c exportply.h exportstl.c exportstl.h exportbitmap.c exportbitmap.h exportsvx.c exportsvx.h recall.c recall.h controlvar.c controlvar.h shadow.c shadow.h longpoll.c longpoll.h exportvdb.c exportvdb.h ovdbc.cpp ovdbc.h audio.c audio.h
___functy_SOURCES = function.c function.h function_private.h functy.c functy.h textures.c textures.h utils.c utils.h vis.c vis.h filesave.c filesave.h cartesian.c cartesian.h spherical.c spherical.h shader.c shader.h curve.c curve.h vecsym.c vecsym.h exportply.c exportply.h exportstl.c exportstl.h exportbitmap.c exportbitmap.h exportsvx.c exportsvx.h recall.c recall.h controlvar.c controlvar.h shadow.c shadow.h longpoll.c longpoll.h exportvdb.c exportvdb.h ovdbc.cpp ovdbc.h audio.c audio.h global.c global.h
___functy_LDADD = -lm @FUNCTY_LIBS@ @SYMBOLIC_LIBS@ @OPENVDB_LIBS@
......
......@@ -110,7 +110,7 @@ am____functy_OBJECTS = ___functy-function.$(OBJEXT) \
___functy-recall.$(OBJEXT) ___functy-controlvar.$(OBJEXT) \
___functy-shadow.$(OBJEXT) ___functy-longpoll.$(OBJEXT) \
___functy-exportvdb.$(OBJEXT) ___functy-ovdbc.$(OBJEXT) \
___functy-audio.$(OBJEXT)
___functy-audio.$(OBJEXT) ___functy-global.$(OBJEXT)
___functy_OBJECTS = $(am____functy_OBJECTS)
___functy_DEPENDENCIES =
am__dirstamp = $(am__leading_dot)dirstamp
......@@ -289,7 +289,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
___functy_SOURCES = function.c function.h function_private.h functy.c functy.h textures.c textures.h utils.c utils.h vis.c vis.h filesave.c filesave.h cartesian.c cartesian.h spherical.c spherical.h shader.c shader.h curve.c curve.h vecsym.c vecsym.h exportply.c exportply.h exportstl.c exportstl.h exportbitmap.c exportbitmap.h exportsvx.c exportsvx.h recall.c recall.h controlvar.c controlvar.h shadow.c shadow.h longpoll.c longpoll.h exportvdb.c exportvdb.h ovdbc.cpp ovdbc.h audio.c audio.h
___functy_SOURCES = function.c function.h function_private.h functy.c functy.h textures.c textures.h utils.c utils.h vis.c vis.h filesave.c filesave.h cartesian.c cartesian.h spherical.c spherical.h shader.c shader.h curve.c curve.h vecsym.c vecsym.h exportply.c exportply.h exportstl.c exportstl.h exportbitmap.c exportbitmap.h exportsvx.c exportsvx.h recall.c recall.h controlvar.c controlvar.h shadow.c shadow.h longpoll.c longpoll.h exportvdb.c exportvdb.h ovdbc.cpp ovdbc.h audio.c audio.h global.c global.h
___functy_LDADD = -lm @FUNCTY_LIBS@ @SYMBOLIC_LIBS@ @OPENVDB_LIBS@
___functy_CPPFLAGS = -DFUNCTYDIR=\"$(datadir)/@PACKAGE@\" -Wall @FUNCTY_CFLAGS@ @SYMBOLIC_CFLAGS@ @OPENVDB_CFLAGS@
all: all-am
......@@ -393,6 +393,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/___functy-filesave.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/___functy-function.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/___functy-functy.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/___functy-global.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/___functy-longpoll.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/___functy-ovdbc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/___functy-recall.Po@am__quote@
......@@ -712,6 +713,20 @@ ___functy-audio.obj: audio.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(___functy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ___functy-audio.obj `if test -f 'audio.c'; then $(CYGPATH_W) 'audio.c'; else $(CYGPATH_W) '$(srcdir)/audio.c'; fi`
___functy-global.o: global.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(___functy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ___functy-global.o -MD -MP -MF $(DEPDIR)/___functy-global.Tpo -c -o ___functy-global.o `test -f 'global.c' || echo '$(srcdir)/'`global.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/___functy-global.Tpo $(DEPDIR)/___functy-global.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='global.c' object='___functy-global.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(___functy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ___functy-global.o `test -f 'global.c' || echo '$(srcdir)/'`global.c
___functy-global.obj: global.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(___functy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ___functy-global.obj -MD -MP -MF $(DEPDIR)/___functy-global.Tpo -c -o ___functy-global.obj `if test -f 'global.c'; then $(CYGPATH_W) 'global.c'; else $(CYGPATH_W) '$(srcdir)/global.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/___functy-global.Tpo $(DEPDIR)/___functy-global.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='global.c' object='___functy-global.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(___functy_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ___functy-global.obj `if test -f 'global.c'; then $(CYGPATH_W) 'global.c'; else $(CYGPATH_W) '$(srcdir)/global.c'; fi`
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
......
......@@ -607,12 +607,25 @@ char * CartesianGenerateFragmentShaderShadow (FuncPersist * psFuncData) {
}
void CartesianInitShader (FuncPersist * psFuncData) {
LoadVertexShader (FUNCTYDIR "/shaders/cartesian.vs", psFuncData);
LoadFragmentShader (FUNCTYDIR "/shaders/cartesian.fs", psFuncData);
GString * szPath;
LoadVertexShaderShadow (FUNCTYDIR "/shaders/cartesian-shadow.vs", psFuncData);
LoadFragmentShaderShadow (FUNCTYDIR "/shaders/cartesian-shadow.fs", psFuncData);
szPath = g_string_new ("/shaders/cartesian.vs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadVertexShader (szPath->str, psFuncData);
szPath = g_string_assign (szPath, "/shaders/cartesian.fs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadFragmentShader (szPath->str, psFuncData);
szPath = g_string_assign (szPath, "/shaders/cartesian-shadow.vs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadVertexShaderShadow (szPath->str, psFuncData);
szPath = g_string_assign (szPath, "/shaders/cartesian-shadow.fs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadFragmentShaderShadow (szPath->str, psFuncData);
g_string_free (szPath, TRUE);
FunctionShadersRegenerate (psFuncData);
}
......
......@@ -1160,12 +1160,25 @@ char * CurveGenerateFragmentShaderShadow (FuncPersist * psFuncData) {
}
void CurveInitShader (FuncPersist * psFuncData) {
LoadVertexShader (FUNCTYDIR "/shaders/curve.vs", psFuncData);
LoadFragmentShader (FUNCTYDIR "/shaders/curve.fs", psFuncData);
GString * szPath;
LoadVertexShaderShadow (FUNCTYDIR "/shaders/curve-shadow.vs", psFuncData);
LoadFragmentShaderShadow (FUNCTYDIR "/shaders/curve-shadow.fs", psFuncData);
szPath = g_string_new ("/shaders/curve.vs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadVertexShader (szPath->str, psFuncData);
szPath = g_string_assign (szPath, "/shaders/curve.fs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadFragmentShader (szPath->str, psFuncData);
szPath = g_string_assign (szPath, "/shaders/curve-shadow.vs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadVertexShaderShadow (szPath->str, psFuncData);
szPath = g_string_assign (szPath, "/shaders/curve-shadow.fs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadFragmentShaderShadow (szPath->str, psFuncData);
g_string_free(szPath, TRUE);
FunctionShadersRegenerate (psFuncData);
}
......
......@@ -41,11 +41,13 @@ void GenerateVertices (FuncPersist * psFuncData);
///////////////////////////////////////////////////////////////////
// Function definitions
FuncPersist * NewFuncPersist (FUNCTYPE eType) {
FuncPersist * NewFuncPersist (FUNCTYPE eType, GlobalPersist const * psGlobalData) {
FuncPersist * psFuncData;
psFuncData = g_new0 (FuncPersist, 1);
psFuncData->psGlobalData = psGlobalData;
psFuncData->eType = eType;
switch (eType) {
case FUNCTYPE_CARTESIAN:
......@@ -279,6 +281,9 @@ void DeleteFuncPersist (FuncPersist * psFuncData) {
// Clear the audio user function data (will be freed in vis)
psFuncData->psUserFuncs = NULL;
// Unlink the global data
psFuncData->psGlobalData = NULL;
g_free (psFuncData);
}
......
......@@ -17,6 +17,7 @@
#include "recall.h"
#include "controlvar.h"
#include "shadow.h"
#include "global.h"
///////////////////////////////////////////////////////////////////
// Defines
......@@ -46,7 +47,7 @@ typedef enum _FUNCTYPE {
///////////////////////////////////////////////////////////////////
// Function prototypes
FuncPersist * NewFuncPersist (FUNCTYPE eType);
FuncPersist * NewFuncPersist (FUNCTYPE eType, GlobalPersist const * psGlobalData);
void DeleteFuncPersist (FuncPersist * psFuncData);
FUNCTYPE GetFunctionType (FuncPersist * psFuncData);
......
......@@ -123,6 +123,9 @@ struct _FuncPersist {
// Audio
UserFunc * psUserFuncs;
// Global
GlobalPersist const * psGlobalData;
};
///////////////////////////////////////////////////////////////////
......
......@@ -101,6 +101,13 @@ typedef struct _AudioComboData {
///////////////////////////////////////////////////////////////////
// Global variables
static char * szArvOptionDataDir = NULL;
static GOptionEntry asEntries[] = {
{"datadir", 'd', G_OPTION_FLAG_NONE, G_OPTION_ARG_FILENAME, & szArvOptionDataDir, "Data directory to use (defaults to '" FUNCTYDIR "')", "DIR"},
{NULL}
};
///////////////////////////////////////////////////////////////////
// Function prototypes
......@@ -224,6 +231,7 @@ FunctyPersist * NewFunctyPersist (void) {
psFunctyData = g_new0 (FunctyPersist, 1);
psFunctyData->psGlobalData = NewGlobalPersist ();
psFunctyData->psVisData = NULL;
psFunctyData->psDrawingArea = NULL;
psFunctyData->boTimeoutContinue = FALSE;
......@@ -271,6 +279,11 @@ FunctyPersist * NewFunctyPersist (void) {
}
void DeleteFunctyPersist (FunctyPersist * psFunctyData) {
if (psFunctyData->psGlobalData) {
DeleteGlobalPersist (psFunctyData->psGlobalData);
psFunctyData->psGlobalData = NULL;
}
if (psFunctyData->psVisData) {
DeleteVisPersist (psFunctyData->psVisData);
psFunctyData->psVisData = NULL;
......@@ -4248,8 +4261,13 @@ void PauseAnimationModal (bool boPauseModal, FunctyPersist * psFunctyData) {
void LoadLicence (FunctyPersist * psFunctyData) {
GFile * psLicence;
GString * szPath;
szPath = g_string_new ("/COPYING");
GenerateDataPath (szPath, psFunctyData->psGlobalData);
psLicence = g_file_new_for_path (szPath->str);
g_string_free (szPath, TRUE);
psLicence = g_file_new_for_path (FUNCTYDIR "/COPYING");
g_file_load_contents (psLicence, NULL, & psFunctyData->szLicence, NULL, NULL, NULL);
g_object_unref (psLicence);
}
......@@ -4306,17 +4324,32 @@ int main (int argc, char *argv[]) {
GString * szWidgetName;
GtkTreeSelection * psSelection;
GtkAdjustment * psAdjustment;
GString * szPath;
GOptionContext * psOptionsContext;
GError * psError = NULL;
// Initialise various libraries
gtk_init (&argc, &argv);
gtk_gl_init (&argc, &argv);
glutInit (&argc, argv);
psOptionsContext = g_option_context_new ("- realtime display of 3D mathematical functions");
g_option_context_add_main_entries (psOptionsContext, asEntries, NULL);
g_option_context_add_group (psOptionsContext, gtk_get_option_group (TRUE));
if (!g_option_context_parse (psOptionsContext, &argc, &argv, & psError)) {
g_print ("Option parsing failed: %s\n", psError->message);
exit (1);
}
// Create new persistent structures
psVisData = NewVisPersist ();
psFunctyData = NewFunctyPersist ();
psVisData = NewVisPersist (psFunctyData->psGlobalData);
psFunctyData->psVisData = psVisData;
if (szArvOptionDataDir) {
SetDataDir (szArvOptionDataDir, psFunctyData->psGlobalData);
}
// First try double buffering
GlConfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGBA | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE | GDK_GL_MODE_ALPHA | GDK_GL_MODE_STENCIL);
if (GlConfig == NULL) {
......@@ -4335,7 +4368,10 @@ int main (int argc, char *argv[]) {
// Load the user interface
psFunctyData->psXML = gtk_builder_new ();
gtk_builder_add_from_file (psFunctyData->psXML, FUNCTYDIR "/functy.ui", NULL);
szPath = g_string_new("/functy.ui");
GenerateDataPath (szPath, psFunctyData->psGlobalData);
gtk_builder_add_from_file (psFunctyData->psXML, szPath->str, NULL);
g_string_free (szPath, TRUE);
// Main window
psWindow = GTK_WIDGET (gtk_builder_get_object(psFunctyData->psXML, "MainWindow"));
......
......@@ -20,6 +20,7 @@
#include "vis.h"
#include "function.h"
#include "global.h"
///////////////////////////////////////////////////////////////////
// Defines
......@@ -40,6 +41,7 @@ typedef enum _BUTTONBARSTYLE {
} BUTTONBARSTYLE;
struct _FunctyPersist {
GlobalPersist * psGlobalData;
VisPersist * psVisData;
GtkWidget * psDrawingArea;
gboolean boTimeoutContinue;
......
......@@ -302,7 +302,7 @@ void ShaderRegenerateFragment (char const * const szShader, ShaderPersist * psSh
LinkShader (psShaderData->uFragment, psShaderData);
}
else {
fprintf (stderr, "Vertex shader file could not be read.\n");
fprintf (stderr, "Fragment shader file could not be read.\n");
}
}
......
......@@ -796,12 +796,25 @@ char * SphericalGenerateFragmentShaderShadow (FuncPersist * psFuncData) {
}
void SphericalInitShader (FuncPersist * psFuncData) {
LoadVertexShader (FUNCTYDIR "/shaders/spherical.vs", psFuncData);
LoadFragmentShader (FUNCTYDIR "/shaders/spherical.fs", psFuncData);
GString * szPath;
szPath = g_string_new ("/shaders/spherical.vs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadVertexShader (szPath->str, psFuncData);
szPath = g_string_assign (szPath, "/shaders/spherical.fs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadFragmentShader (szPath->str, psFuncData);
LoadVertexShaderShadow (FUNCTYDIR "/shaders/spherical-shadow.vs", psFuncData);
LoadFragmentShaderShadow (FUNCTYDIR "/shaders/spherical-shadow.fs", psFuncData);
szPath = g_string_assign (szPath, "/shaders/spherical-shadow.vs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadVertexShaderShadow (szPath->str, psFuncData);
szPath = g_string_assign (szPath, "/shaders/spherical-shadow.fs");
GenerateDataPath (szPath, psFuncData->psGlobalData);
LoadFragmentShaderShadow (szPath->str, psFuncData);
g_string_free (szPath, TRUE);
FunctionShadersRegenerate (psFuncData);
}
......
......@@ -62,7 +62,7 @@ void DeleteTexPersist (TexPersist * psTexData) {
void LoadTextures (TexPersist * psTexData) {
psTexData->aunTextureName[TEXNAME_AUDIO] = CreateBlankTextureSingleChannel (AUDIO_BARS, 1);
//LoadTextureRaw (FUNCTYDIR "/Grid.raw", 256, 256, TRUE, psTexData);
//LoadTextureRaw ("Grid.raw", 256, 256, TRUE, psTexData);
//LoadTextureRaw ("/home/flypig/Documents/Development/Projects/Functy/Star.raw", 256, 256, TRUE, psTexData);
}
......
......@@ -184,6 +184,9 @@ struct _VisPersist {
// Audio
AudioPersist * psAudioData;
UserFunc * psUserFuncs;
// Global
GlobalPersist const * psGlobalData;
};
///////////////////////////////////////////////////////////////////
......@@ -264,13 +267,15 @@ void inline order (float * pfVar1, float * pfVar2) {
}
}
VisPersist * NewVisPersist (void) {
VisPersist * NewVisPersist (GlobalPersist const * psGlobalData) {
VisPersist * psVisData;
int nFramebuffer;
//FuncPersist * psFuncData;
psVisData = g_new0 (VisPersist, 1);
psVisData->psGlobalData = psGlobalData;
psVisData->fViewRadius = VIEW_RADIUS;
psVisData->fRotation = 0.0f;
......@@ -332,7 +337,7 @@ VisPersist * NewVisPersist (void) {
/*
// Add a function to the list
psFuncData = NewFuncPersist (FUNCTYPE_SPHERICAL, 0.02);
psFuncData = NewFuncPersist (FUNCTYPE_SPHERICAL, 0.02, psVisData->psGlobalData);
SetFunction (FUNCTION1, psFuncData);
SetFunctionRange (psVisData->fXMin, psVisData->fYMin, psVisData->fZMin,
psVisData->fXWidth, psVisData->fYWidth, psVisData->fZWidth, psFuncData);
......@@ -340,7 +345,7 @@ VisPersist * NewVisPersist (void) {
psVisData->psFuncList = g_slist_prepend (psVisData->psFuncList, psFuncData);
// Add a function to the list
psFuncData = NewFuncPersist (FUNCTYPE_SPHERICAL, 0.02);
psFuncData = NewFuncPersist (FUNCTYPE_SPHERICAL, 0.02, psVisData->psGlobalData);
SetFunction (FUNCTION2, psFuncData);
SetFunctionRange (psVisData->fXMin, psVisData->fYMin, psVisData->fZMin,
psVisData->fXWidth, psVisData->fYWidth, psVisData->fZWidth, psFuncData);
......@@ -407,6 +412,9 @@ void DeleteVisPersist (VisPersist * psVisData) {
psVisData->psAudioData = NULL;
psVisData->psUserFuncs = FreeUserFuncs (psVisData->psUserFuncs);
// Unlink the global data
psVisData->psGlobalData = NULL;
g_free (psVisData);
}
......@@ -419,7 +427,7 @@ FuncPersist * AddNewFunction (FUNCTYPE eType, VisPersist * psVisData) {
GString * szName;
unsigned int uFunctionCount;
psFuncData = NewFuncPersist (eType);
psFuncData = NewFuncPersist (eType, psVisData->psGlobalData);
SetFunctionTextureData (psVisData->psTexData, psFuncData);
SetFunctionTexture (TEXTURE_NONE, psFuncData);
SetFunctionControlVars (psVisData->psFnControlData, psFuncData);
......@@ -785,6 +793,7 @@ void Init (VisPersist * psVisData) {
char * szShaderVertexSource;
char * szShaderFragmentSource;
struct timeb sTime;
GString * szPath;
for (nCount = 0; nCount < MAXKEYS; nCount++) {
psVisData->aboKeyDown[nCount] = false;
......@@ -792,8 +801,14 @@ void Init (VisPersist * psVisData) {
// Inititalise the shader
psVisData->psScreenShader = NewShaderPersist ();
szShaderVertexSource = LoadShaderFile (FUNCTYDIR "/shaders/screen.vs");
szShaderFragmentSource = LoadShaderFile (FUNCTYDIR "/shaders/screen.fs");
szPath = g_string_new ("/shaders/screen.vs");
GenerateDataPath (szPath, psVisData->psGlobalData);
szShaderVertexSource = LoadShaderFile (szPath->str);
szPath = g_string_assign (szPath, "/shaders/screen.fs");
GenerateDataPath (szPath, psVisData->psGlobalData);
szShaderFragmentSource = LoadShaderFile (szPath->str);
// Generate the shaders
ShaderRegenerateVertex (szShaderVertexSource, psVisData->psScreenShader);
......@@ -805,8 +820,16 @@ void Init (VisPersist * psVisData) {
// Initialise the debug depth shader
psVisData->psDebugDepthShader = NewShaderPersist ();
szShaderVertexSource = LoadShaderFile (FUNCTYDIR "/shaders/depth.vs");
szShaderFragmentSource = LoadShaderFile (FUNCTYDIR "/shaders/depth.fs");
szPath = g_string_assign (szPath, "/shaders/depth.vs");
GenerateDataPath (szPath, psVisData->psGlobalData);
szShaderVertexSource = LoadShaderFile (szPath->str);
szPath = g_string_assign (szPath, "/shaders/depth.fs");
GenerateDataPath (szPath, psVisData->psGlobalData);
szShaderFragmentSource = LoadShaderFile (szPath->str);
g_string_free (szPath, TRUE);
// Generate the debug shaders
ShaderRegenerateVertex (szShaderVertexSource, psVisData->psDebugDepthShader);
......
......@@ -18,6 +18,7 @@
#include "function.h"
#include "controlvar.h"
#include "audio.h"
#include "global.h"
///////////////////////////////////////////////////////////////////
// Defines
......@@ -57,7 +58,7 @@ typedef struct _VisPersist VisPersist;
///////////////////////////////////////////////////////////////////
// Function prototypes
VisPersist * NewVisPersist (void);
VisPersist * NewVisPersist (GlobalPersist const * psGlobalData);
void DeleteVisPersist (VisPersist * psVisData);
void Redraw (VisPersist * psVisData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment