Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptum committed Apr 22, 2012
1 parent 38ff12e commit 65b5778
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 144 deletions.
18 changes: 9 additions & 9 deletions bin/Release/lib/cheetah.h
Expand Up @@ -180,6 +180,7 @@ void enableBlend();
void disableBlend();
void push();
void pop();
void reset();
void line(double x1, double y1, double x2, double y2);
void rectangle();
void rectanglexy(float x, float y, float w, float h);
Expand All @@ -189,15 +190,23 @@ void point();
void pointxy(float x, float y);
void pointSize(float size);
double getPointSize();
void lineWidth(float width);
double getLineWidth();
void smooth(bool smooth);
void color(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
void colorf(float r, float g, float b, float a);
void clearColor(float r, float g, float b, float a);
void clearScreen(bool enabled);
void blendMode(int mode);
void blendEquation(int mode);
void blendFunc(int sourcefactor, int destinationfactor);
void clear();
void clearColorDepth();
void clearColorStencil();
void clearDepth();
void clearStencil();
void stencilFunc(int func, int ref, unsigned int mask);
void stencilOp(int fail, int zfail, int zpass);
void drawToStencil();
void drawUsingStencil();
void newImageOpt(Image* ptr, const char *name, const char *options);
Expand Down Expand Up @@ -243,15 +252,6 @@ int getWindowWidth();
int getWindowHeight();
void caption(const char * text);
SDL_Rect ** getModes();
void (*reset)(void);
void (*lineWidth)(float width);
void (*color)(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
void (*colorf)(float r, float g, float b, float a);
void (*clearColor)(float r, float g, float b, float a);
void (*blendEquation)(int mode);
void (*blendFunc)(int sourcefactor, int destinationfactor);
void (*stencilFunc)(int func, int ref, unsigned int mask);
void (*stencilOp)(int fail, int zfail, int zpass);
void (*swapBuffers)(void);
int (*showCursor)(int mode);
int (*grabCursor)(int mode);
30 changes: 15 additions & 15 deletions cheetah.make
Expand Up @@ -14,9 +14,9 @@ ifeq ($(CONFIG),Release)
OBJDIR := obj/Release
OUTDIR := bin/Release
CPPFLAGS := $(DEPFLAGS) -I "inc"
CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -fPIC -g -O3 -fomit-frame-pointer -ffast-math -Wall -msse -ftracer -fpeel-loops
CFLAGS += $(CPPFLAGS) $(TARGET_ARCH) -fPIC -g -O3 -fomit-frame-pointer -ffast-math -Wall -msse
CXXFLAGS += $(CFLAGS)
LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -s -L"lib" -lSDL -lSDLmain -lGL
LDFLAGS += -L$(BINDIR) -L$(LIBDIR) -shared -s -L"lib" -lSDL -lGL
LDDEPS :=
RESFLAGS := -I "inc"
TARGET := libcheetah.so
Expand All @@ -34,17 +34,17 @@ OBJECTS := \
$(OBJDIR)/filesystem.o \
$(OBJDIR)/font.o \
$(OBJDIR)/framebuffer.o \
$(OBJDIR)/generator.o \
$(OBJDIR)/graphics.o \
$(OBJDIR)/image.o \
$(OBJDIR)/shader.o \
$(OBJDIR)/thread.o \
$(OBJDIR)/vbo.o \
$(OBJDIR)/window.o \
$(OBJDIR)/SOIL.o \
$(OBJDIR)/graphics.o \
$(OBJDIR)/generator.o \
$(OBJDIR)/stb_image_aug.o \
$(OBJDIR)/image_DXT.o \
$(OBJDIR)/image_helper.o \
$(OBJDIR)/stb_image_aug.o \
$(OBJDIR)/SOIL.o \

MKDIR_TYPE := msdos
CMD := $(subst \,\\,$(ComSpec)$(COMSPEC))
Expand Down Expand Up @@ -112,42 +112,42 @@ $(OBJDIR)/framebuffer.o: src/framebuffer.c
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/generator.o: src/generator.c
$(OBJDIR)/image.o: src/image.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/graphics.o: src/graphics.c
$(OBJDIR)/shader.o: src/shader.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/image.o: src/image.c
$(OBJDIR)/thread.o: src/thread.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/shader.o: src/shader.c
$(OBJDIR)/vbo.o: src/vbo.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/thread.o: src/thread.c
$(OBJDIR)/window.o: src/window.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/vbo.o: src/vbo.c
$(OBJDIR)/graphics.o: src/graphics.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/window.o: src/window.c
$(OBJDIR)/generator.o: src/generator.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/SOIL.o: src/SOIL/SOIL.c
$(OBJDIR)/stb_image_aug.o: src/SOIL/stb_image_aug.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"
Expand All @@ -162,7 +162,7 @@ $(OBJDIR)/image_helper.o: src/SOIL/image_helper.c
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"

$(OBJDIR)/stb_image_aug.o: src/SOIL/stb_image_aug.c
$(OBJDIR)/SOIL.o: src/SOIL/SOIL.c
-@$(CMD_MKOBJDIR)
@echo $(notdir $<)
@$(CC) $(CFLAGS) -o "$@" -c "$<"
Expand Down
8 changes: 3 additions & 5 deletions premake.lua
Expand Up @@ -6,8 +6,6 @@ package.files = {
"src/*.h", "src/*.c",
"src/SOIL/*.h",
"src/SOIL/*.c"
--~ "Graphics/*.h",
--~ "Graphics/*.c"
)
}
project.configs = {"Release"}
Expand All @@ -18,13 +16,13 @@ package.includepaths = {
--~ "thirdparty/LuaJIT/src",
"inc"
}
package.links = {"SDL", "SDLmain", "GL", --[["luajit",]]}
package.buildoptions = { "-ffast-math -Wall -msse -ftracer -fpeel-loops",
package.links = {"SDL", "GL", --[["luajit",]]}
package.buildoptions = { "-ffast-math -Wall -msse",
--~ " -ftracer -fcx-limited-range -fgcse-las -fgcse-sm -fno-trapping-math -fpeel-loops -fsingle-precision-constant -funsafe-loop-optimizations"
}
--~ package.buildoptions = { "-ffast-math -mtune=generic -march=core2" }
package.linkoptions = { "-s" }
--~ package.buildoptions = { "-g" }
--~ package.buildoptions = { "-s" }
package.postbuildcommands = {
"./genheader.sh"
}
206 changes: 103 additions & 103 deletions src/SOIL/SOIL.c
Expand Up @@ -157,110 +157,110 @@ unsigned int SOIL_direct_load_DDS_from_memory(
/* other functions */


/* and the code magic begins here [8^) */
unsigned int
SOIL_load_OGL_texture
(
const char *filename,
int force_channels,
unsigned int reuse_texture_ID,
unsigned int flags
)
{
/* variables */
unsigned char* img;
int width, height, channels;
unsigned int tex_id;
/* does the user want direct uploading of the image as a DDS file? */
if( flags & SOIL_FLAG_DDS_LOAD_DIRECT )
{
/* 1st try direct loading of the image as a DDS file
note: direct uploading will only load what is in the
DDS file, no MIPmaps will be generated, the image will
not be flipped, etc. */
tex_id = SOIL_direct_load_DDS( filename, reuse_texture_ID, flags, 0 );
if( tex_id )
{
/* hey, it worked!! */
return tex_id;
}
}
/* try to load the image */
img = SOIL_load_image( filename, &width, &height, &channels, force_channels );
/* channels holds the original number of channels, which may have been forced */
if( (force_channels >= 1) && (force_channels <= 4) )
{
channels = force_channels;
}
if( NULL == img )
{
/* image loading failed */
result_string_pointer = stbi_failure_reason();
return 0;
}
/* OK, make it a texture! */
tex_id = SOIL_internal_create_OGL_texture(
img, width, height, channels,
reuse_texture_ID, flags,
GL_TEXTURE_2D, GL_TEXTURE_2D,
GL_MAX_TEXTURE_SIZE );
/* and nuke the image data */
SOIL_free_image_data( img );
/* and return the handle, such as it is */
return tex_id;
}
//~ /* and the code magic begins here [8^) */
//~ unsigned int
//~ SOIL_load_OGL_texture
//~ (
//~ const char *filename,
//~ int force_channels,
//~ unsigned int reuse_texture_ID,
//~ unsigned int flags
//~ )
//~ {
//~ /* variables */
//~ unsigned char* img;
//~ int width, height, channels;
//~ unsigned int tex_id;
//~ /* does the user want direct uploading of the image as a DDS file? */
//~ if( flags & SOIL_FLAG_DDS_LOAD_DIRECT )
//~ {
//~ /* 1st try direct loading of the image as a DDS file
//~ note: direct uploading will only load what is in the
//~ DDS file, no MIPmaps will be generated, the image will
//~ not be flipped, etc. */
//~ tex_id = SOIL_direct_load_DDS( filename, reuse_texture_ID, flags, 0 );
//~ if( tex_id )
//~ {
//~ /* hey, it worked!! */
//~ return tex_id;
//~ }
//~ }
//~ /* try to load the image */
//~ img = SOIL_load_image( filename, &width, &height, &channels, force_channels );
//~ /* channels holds the original number of channels, which may have been forced */
//~ if( (force_channels >= 1) && (force_channels <= 4) )
//~ {
//~ channels = force_channels;
//~ }
//~ if( NULL == img )
//~ {
//~ /* image loading failed */
//~ result_string_pointer = stbi_failure_reason();
//~ return 0;
//~ }
//~ /* OK, make it a texture! */
//~ tex_id = SOIL_internal_create_OGL_texture(
//~ img, width, height, channels,
//~ reuse_texture_ID, flags,
//~ GL_TEXTURE_2D, GL_TEXTURE_2D,
//~ GL_MAX_TEXTURE_SIZE );
//~ /* and nuke the image data */
//~ SOIL_free_image_data( img );
//~ /* and return the handle, such as it is */
//~ return tex_id;
//~ }

unsigned int
SOIL_load_OGL_HDR_texture
(
const char *filename,
int fake_HDR_format,
int rescale_to_max,
unsigned int reuse_texture_ID,
unsigned int flags
)
{
/* variables */
unsigned char* img;
int width, height, channels;
unsigned int tex_id;
/* no direct uploading of the image as a DDS file */
/* error check */
if( (fake_HDR_format != SOIL_HDR_RGBE) &&
(fake_HDR_format != SOIL_HDR_RGBdivA) &&
(fake_HDR_format != SOIL_HDR_RGBdivA2) )
{
result_string_pointer = "Invalid fake HDR format specified";
return 0;
}
/* try to load the image (only the HDR type) */
img = stbi_hdr_load_rgbe( filename, &width, &height, &channels, 4 );
/* channels holds the original number of channels, which may have been forced */
if( NULL == img )
{
/* image loading failed */
result_string_pointer = stbi_failure_reason();
return 0;
}
/* the load worked, do I need to convert it? */
if( fake_HDR_format == SOIL_HDR_RGBdivA )
{
RGBE_to_RGBdivA( img, width, height, rescale_to_max );
} else if( fake_HDR_format == SOIL_HDR_RGBdivA2 )
{
RGBE_to_RGBdivA2( img, width, height, rescale_to_max );
}
/* OK, make it a texture! */
tex_id = SOIL_internal_create_OGL_texture(
img, width, height, channels,
reuse_texture_ID, flags,
GL_TEXTURE_2D, GL_TEXTURE_2D,
GL_MAX_TEXTURE_SIZE );
/* and nuke the image data */
SOIL_free_image_data( img );
/* and return the handle, such as it is */
return tex_id;
}
//~ unsigned int
//~ SOIL_load_OGL_HDR_texture
//~ (
//~ const char *filename,
//~ int fake_HDR_format,
//~ int rescale_to_max,
//~ unsigned int reuse_texture_ID,
//~ unsigned int flags
//~ )
//~ {
//~ /* variables */
//~ unsigned char* img;
//~ int width, height, channels;
//~ unsigned int tex_id;
//~ /* no direct uploading of the image as a DDS file */
//~ /* error check */
//~ if( (fake_HDR_format != SOIL_HDR_RGBE) &&
//~ (fake_HDR_format != SOIL_HDR_RGBdivA) &&
//~ (fake_HDR_format != SOIL_HDR_RGBdivA2) )
//~ {
//~ result_string_pointer = "Invalid fake HDR format specified";
//~ return 0;
//~ }
//~ /* try to load the image (only the HDR type) */
//~ img = stbi_hdr_load_rgbe( filename, &width, &height, &channels, 4 );
//~ /* channels holds the original number of channels, which may have been forced */
//~ if( NULL == img )
//~ {
//~ /* image loading failed */
//~ result_string_pointer = stbi_failure_reason();
//~ return 0;
//~ }
//~ /* the load worked, do I need to convert it? */
//~ if( fake_HDR_format == SOIL_HDR_RGBdivA )
//~ {
//~ RGBE_to_RGBdivA( img, width, height, rescale_to_max );
//~ } else if( fake_HDR_format == SOIL_HDR_RGBdivA2 )
//~ {
//~ RGBE_to_RGBdivA2( img, width, height, rescale_to_max );
//~ }
//~ /* OK, make it a texture! */
//~ tex_id = SOIL_internal_create_OGL_texture(
//~ img, width, height, channels,
//~ reuse_texture_ID, flags,
//~ GL_TEXTURE_2D, GL_TEXTURE_2D,
//~ GL_MAX_TEXTURE_SIZE );
//~ /* and nuke the image data */
//~ SOIL_free_image_data( img );
//~ /* and return the handle, such as it is */
//~ return tex_id;
//~ }

unsigned int
SOIL_load_OGL_texture_from_memory
Expand Down
3 changes: 3 additions & 0 deletions src/SOIL/stb_image_aug.c
Expand Up @@ -65,6 +65,9 @@

#include "stb_image_aug.h"

#define STBI_NO_HDR
#define STBI_NO_STDIO

#ifndef STBI_NO_HDR
#include <math.h> // ldexp
#include <string.h> // strcmp
Expand Down

0 comments on commit 65b5778

Please sign in to comment.