reverting previous commit from Mitchell. His commit went to the trunk instead of the branch :)

svn merge -r 29067:29066 https://svn.blender.org/svnroot/bf-blender/trunk/blender
This commit is contained in:
Dalai Felinto 2010-05-29 21:31:57 +00:00
parent 9d3157eed0
commit c6bec43330
29 changed files with 251 additions and 383 deletions

View File

@ -162,19 +162,23 @@ IF(UNIX AND NOT APPLE)
FIND_PACKAGE(Freetype)
# UNSET(FREETYPE_INCLUDE_DIRS CACHE) # cant use
# No way to set py31. remove for now.
# FIND_PACKAGE(PythonLibs)
SET(PYTHON /usr)
SET(PYTHON_VERSION 3.1)
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
# SET(PYTHON_BINARY python) # not used yet
SET(PYTHON_LIB python${PYTHON_VERSION} CACHE STRING "")
SET(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "")
# FIND_PACKAGE(PythonInterp) # not used yet
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
IF(WITH_PYTHON)
# No way to set py31. remove for now.
# FIND_PACKAGE(PythonLibs)
SET(PYTHON /usr)
SET(PYTHON_VERSION 3.1)
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
# SET(PYTHON_BINARY python) # not used yet
SET(PYTHON_LIB python${PYTHON_VERSION} CACHE STRING "")
SET(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "")
# FIND_PACKAGE(PythonInterp) # not used yet
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
ENDIF(WITH_PYTHON)
IF(WITH_SDL)
FIND_PACKAGE(SDL)
@ -184,23 +188,27 @@ IF(UNIX AND NOT APPLE)
ENDIF(NOT SDL_FOUND)
ENDIF(WITH_SDL)
SET(OPENEXR /usr CACHE FILEPATH "OPENEXR Directory")
FIND_PATH(OPENEXR_INC
ImfXdr.h
PATHS
${OPENEXR}/include/OpenEXR
/usr/local/include/OpenEXR
/sw/include/OpenEXR
/opt/local/include/OpenEXR
/opt/csw/include/OpenEXR
/opt/include/OpenEXR
)
SET(OPENEXR_LIB Half IlmImf Iex Imath)
IF(WITH_OPENEXR)
SET(OPENEXR /usr CACHE FILEPATH "OPENEXR Directory")
FIND_PATH(OPENEXR_INC
ImfXdr.h
PATHS
${OPENEXR}/include/OpenEXR
/usr/local/include/OpenEXR
/sw/include/OpenEXR
/opt/local/include/OpenEXR
/opt/csw/include/OpenEXR
/opt/include/OpenEXR
)
SET(OPENEXR_LIB Half IlmImf Iex Imath)
ENDIF(WITH_OPENEXR)
SET(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory")
SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
IF(WITH_FFMPEG)
SET(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory")
SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
ENDIF(WITH_FFMPEG)
IF(WITH_FFTW3)
SET(FFTW3 /usr)
@ -247,6 +255,10 @@ IF(UNIX AND NOT APPLE)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# BSD's dont use libdl.so
SET(LLIBS "${LLIBS} -ldl")
# binreloc is linux only
SET(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
SET(BINRELOC_INC ${BINRELOC}/include)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(WITH_OPENMP)
@ -267,6 +279,7 @@ IF(UNIX AND NOT APPLE)
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
ENDIF(UNIX AND NOT APPLE)
IF(WIN32)
# this file is included anyway when building under Windows with cl.exe
@ -279,13 +292,37 @@ IF(WIN32)
message("64 bit compiler detected.")
SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
ENDIF(CMAKE_CL_64)
ADD_DEFINITIONS(-DWIN32)
SET(PYTHON ${LIBDIR}/python)
SET(PYTHON_VERSION 3.1)
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
# SET(PYTHON_BINARY python) # not used yet
SET(PYTHON_LIB python31)
SET(PYTHON_LIBPATH ${PYTHON}/lib)
SET(ICONV ${LIBDIR}/iconv)
SET(ICONV_INC ${ICONV}/include)
SET(ICONV_LIB iconv)
SET(ICONV_LIBPATH ${ICONV}/lib)
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
SET(LIBSAMPLERATE_LIB libsamplerate)
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
SET(PNG "${LIBDIR}/png")
SET(PNG_INC "${PNG}/include")
SET(PNG_LIBPATH ${PNG}/lib)
SET(JPEG "${LIBDIR}/jpeg")
SET(JPEG_INC "${JPEG}/include")
SET(JPEG_LIBPATH ${JPEG}/lib)
SET(WINTAB_INC ${LIBDIR}/wintab/include)
IF(WITH_PYTHON)
SET(PYTHON ${LIBDIR}/python)
SET(PYTHON_VERSION 3.1)
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
# SET(PYTHON_BINARY python) # not used yet
SET(PYTHON_LIB python31)
SET(PYTHON_LIBPATH ${PYTHON}/lib)
ENDIF(WITH_PYTHON)
IF(WITH_OPENAL)
SET(OPENAL ${LIBDIR}/openal)
@ -300,36 +337,20 @@ IF(WIN32)
SET(SNDFILE_LIB libsndfile-1)
SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
ENDIF(WITH_SNDFILE)
SET(ICONV ${LIBDIR}/iconv)
SET(ICONV_INC ${ICONV}/include)
SET(ICONV_LIB iconv)
SET(ICONV_LIBPATH ${ICONV}/lib)
SET(QUICKTIME ${LIBDIR}/QTDevWin)
SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
SET(QUICKTIME_LIB qtmlClient)
SET(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
IF(WITH_SDL)
SET(SDL ${LIBDIR}/sdl)
SET(SDL_INCLUDE_DIR ${SDL}/include)
SET(SDL_LIBRARY SDL)
SET(SDL_LIBPATH ${SDL}/lib)
ENDIF(WITH_SDL)
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
SET(LIBSAMPLERATE_LIB libsamplerate)
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
SET(SDL ${LIBDIR}/sdl)
SET(SDL_INCLUDE_DIR ${SDL}/include)
SET(SDL_LIBRARY SDL)
SET(SDL_LIBPATH ${SDL}/lib)
SET(PNG "${LIBDIR}/png")
SET(PNG_INC "${PNG}/include")
SET(PNG_LIBPATH ${PNG}/lib)
SET(JPEG "${LIBDIR}/jpeg")
SET(JPEG_INC "${JPEG}/include")
SET(JPEG_LIBPATH ${JPEG}/lib)
SET(WINTAB_INC ${LIBDIR}/wintab/include)
IF(WITH_QUICKTIME)
SET(QUICKTIME ${LIBDIR}/QTDevWin)
SET(QUICKTIME_INC ${QUICKTIME}/CIncludes)
SET(QUICKTIME_LIB qtmlClient)
SET(QUICKTIME_LIBPATH ${QUICKTIME}/Libraries)
ENDIF(WITH_QUICKTIME)
IF(MSVC)
IF(CMAKE_CL_64)
@ -349,8 +370,6 @@ IF(WIN32)
SET(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_C_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
ADD_DEFINITIONS(-DWIN32)
IF(WITH_OPENMP)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /openmp ")
@ -457,19 +476,19 @@ IF(WIN32)
ELSE(MSVC) # MINGW
SET(LLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid")
SET(CMAKE_CXX_FLAGS "-pipe -funsigned-char -fno-strict-aliasing -mwindows" CACHE STRING "Mingw C++ flags " FORCE)
SET(CMAKE_C_FLAGS "-pipe -funsigned-char -fno-strict-aliasing" CACHE STRING "Mingw C flags " FORCE)
SET(CMAKE_CXX_FLAGS "-pipe -funsigned-char -fno-strict-aliasing -mwindows" CACHE STRING "Mingw C++ flags ")
SET(CMAKE_C_FLAGS "-pipe -funsigned-char -fno-strict-aliasing" CACHE STRING "Mingw C flags ")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING "Mingw debug C++ flags " FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE " -O2" CACHE STRING "Mingw release C++ flags " FORCE)
SET(CMAKE_CXX_FLAGS_MINSIZEREL " -Os" CACHE STRING "Mingw minsize release C++ flags " FORCE)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Mingw release, debug C++ flags " FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING "Mingw debug C++ flags ")
SET(CMAKE_CXX_FLAGS_RELEASE " -O2" CACHE STRING "Mingw release C++ flags ")
SET(CMAKE_CXX_FLAGS_MINSIZEREL " -Os" CACHE STRING "Mingw minsize release C++ flags ")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Mingw release, debug C++ flags ")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g" CACHE STRING "Mingw debug C flags " FORCE)
SET(CMAKE_C_FLAGS_RELEASE "-O2" CACHE STRING "Mingw release C flags " FORCE)
SET(CMAKE_C_FLAGS_MINSIZEREL "-Os" CACHE STRING "Mingw minsize release C flags " FORCE)
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Mingw release, debug C++ flags " FORCE)
ADD_DEFINITIONS(-DFREE_WINDOWS -DWIN32)
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g" CACHE STRING "Mingw debug C flags ")
SET(CMAKE_C_FLAGS_RELEASE "-O2" CACHE STRING "Mingw release C flags ")
SET(CMAKE_C_FLAGS_MINSIZEREL "-Os" CACHE STRING "Mingw minsize release C flags ")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Mingw release, debug C++ flags ")
ADD_DEFINITIONS(-DFREE_WINDOWS)
IF(WITH_OPENMP)
SET(LLIBS "${LLIBS} -lgomp")
@ -526,7 +545,7 @@ IF(WIN32)
IF(WITH_OPENEXR)
SET(OPENEXR ${LIBDIR}/gcc/openexr)
SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/OpenEXR)
SET(OPENEXR_LIB Half IlmImf Iex)
SET(OPENEXR_LIB Half IlmImf Iex IlmThread)
SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
ENDIF(WITH_OPENEXR)
@ -551,6 +570,7 @@ IF(WIN32)
ENDIF(WIN32)
IF(APPLE)
IF(WITH_LIBS10.5)
SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
@ -729,11 +749,6 @@ IF(APPLE)
ENDIF(APPLE)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
SET(BINRELOC_INC ${BINRELOC}/include)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# buildinfo
IF(WITH_BUILDINFO)

View File

@ -55,7 +55,7 @@ WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/gcc/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Half IlmImf Iex '
BF_OPENEXR_LIB = ' Half IlmImf Iex IlmThread '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'

View File

@ -54,7 +54,7 @@ WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/gcc/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Half IlmImf Iex '
BF_OPENEXR_LIB = ' Half IlmImf Iex IlmThread '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'

View File

@ -258,7 +258,7 @@ public:
* @return Indication of success.
*/
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0) = 0;
const bool stereoVisual) = 0;
/**
* Ends full screen mode.

View File

@ -133,7 +133,7 @@ bool GHOST_System::validWindow(GHOST_IWindow* window)
GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
const bool stereoVisual)
{
GHOST_TSuccess success = GHOST_kFailure;
GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager")
@ -145,7 +145,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting);
if (success == GHOST_kSuccess) {
//GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
success = createFullScreenWindow((GHOST_Window**)window, stereoVisual, numOfAASamples);
success = createFullScreenWindow((GHOST_Window**)window, stereoVisual);
if (success == GHOST_kSuccess) {
m_windowManager->beginFullScreen(*window, stereoVisual);
}
@ -327,7 +327,7 @@ GHOST_TSuccess GHOST_System::exit()
}
GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window** window, const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window** window, const bool stereoVisual)
{
GHOST_TSuccess success;
GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager")
@ -341,8 +341,7 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window** window, const
0, 0, settings.xPixels, settings.yPixels,
GHOST_kWindowStateFullScreen,
GHOST_kDrawingContextTypeOpenGL,
stereoVisual,
numOfAASamples);
stereoVisual);
success = *window == 0 ? GHOST_kFailure : GHOST_kSuccess;
}
return success;

View File

@ -141,7 +141,7 @@ public:
* @return Indication of success.
*/
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0);
const bool stereoVisual);
/**
* Ends full screen mode.
@ -330,7 +330,7 @@ protected:
* @return Indication of success.
*/
virtual GHOST_TSuccess createFullScreenWindow(GHOST_Window** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0);
const bool stereoVisual);
/** The display manager (platform dependant). */
GHOST_DisplayManager* m_displayManager;

View File

@ -1659,7 +1659,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
if ((but->y1 <= my) && (my <= but->y2) && (but->x1 <= mx) && (mx <= but->x2)) {
if (ui_mouse_inside_button(data->region, but, mx, my)) {
ui_textedit_set_cursor_pos(but, data, mx);
but->selsta = but->selend = but->pos;
data->selstartx= mx;
@ -1999,14 +1999,17 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
if(event->type == MOUSEMOVE)
return WM_UI_HANDLER_CONTINUE;
if(event->type == ESCKEY) {
/* data->cancel doesnt work, this button opens immediate */
if(but->flag & UI_BUT_IMMEDIATE)
ui_set_but_val(but, 0);
else
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
/* only cancel if click outside the button */
if(ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) {
/* data->cancel doesnt work, this button opens immediate */
if(but->flag & UI_BUT_IMMEDIATE)
ui_set_but_val(but, 0);
else
data->cancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
return WM_UI_HANDLER_BREAK;
}
}
/* always set */
@ -2040,15 +2043,11 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
return WM_UI_HANDLER_CONTINUE;
}
static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
if(data->state == BUTTON_STATE_HIGHLIGHT) {
if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
short event= (short)ui_get_but_val(but);
/* hardcoded prevention from editing or assigning ESC */
if(event!=ESCKEY)
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
return WM_UI_HANDLER_BREAK;
}
}
@ -2057,7 +2056,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
return WM_UI_HANDLER_CONTINUE;
if(event->val==KM_PRESS) {
if(event->type!=ESCKEY && WM_key_event_string(event->type)[0])
if(WM_key_event_string(event->type)[0])
ui_set_but_val(but, event->type);
else
data->cancel= 1;

View File

@ -30,10 +30,13 @@
#include <stdlib.h>
#include <stdio.h>
#include "MEM_guardedalloc.h"
#include "DNA_packedFile_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_sequence_types.h"
#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
@ -61,17 +64,30 @@
/******************** open sound operator ********************/
static void open_init(bContext *C, wmOperator *op)
{
PropertyPointerRNA *pprop;
op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
}
static int open_exec(bContext *C, wmOperator *op)
{
char path[FILE_MAX];
bSound *sound;
PropertyPointerRNA *pprop;
PointerRNA idptr;
AUD_SoundInfo info;
RNA_string_get(op->ptr, "path", path);
sound = sound_new_file(CTX_data_main(C), path);
if(!op->customdata)
open_init(C, op);
if (sound==NULL || sound->playback_handle == NULL) {
if(op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
@ -80,6 +96,7 @@ static int open_exec(bContext *C, wmOperator *op)
if (info.specs.channels == AUD_CHANNELS_INVALID) {
sound_delete(C, sound);
if(op->customdata) MEM_freeN(op->customdata);
BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
return OPERATOR_CANCELLED;
}
@ -87,12 +104,34 @@ static int open_exec(bContext *C, wmOperator *op)
if (RNA_boolean_get(op->ptr, "cache")) {
sound_cache(sound, 0);
}
/* hook into UI */
pprop= op->customdata;
if(pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer se also increases user, so this compensates it */
sound->id.us--;
RNA_id_pointer_create(&sound->id, &idptr);
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
MEM_freeN(op->customdata);
return OPERATOR_FINISHED;
}
static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
if(RNA_property_is_set(op->ptr, "path"))
return open_exec(C, op);
open_init(C, op);
return WM_operator_filesel(C, op, event);
}
@ -113,6 +152,7 @@ void SOUND_OT_open(wmOperatorType *ot)
/* properties */
WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE);
RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory.");
RNA_def_boolean(ot->srna, "relative_path", FALSE, "Relative Path", "Load image with relative path to current .blend file");
}
/* ******************************************************* */

View File

@ -1157,8 +1157,8 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
else {
/* Set y move = x move as MOUSEZOOM uses only x axis to pass magnification value */
vod->origy = vod->oldy = event->x;
viewzoom_apply(vod, event->x, event->prevx, USER_ZOOM_DOLLY);
vod->origy = vod->oldy = vod->origy + event->x - event->prevx;
viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY);
}
request_depth_update(CTX_wm_region_view3d(C));

View File

@ -402,7 +402,6 @@ extern Object workob;
#define OB_BOUND_POLYH 4
#define OB_BOUND_POLYT 5
#define OB_BOUND_DYN_MESH 6
#define OB_BOUND_CAPSULE 7
/* **************** BASE ********************* */

View File

@ -73,7 +73,6 @@ static EnumPropertyItem collision_bounds_items[] = {
{OB_BOUND_CONE, "CONE", 0, "Cone", ""},
{OB_BOUND_POLYT, "CONVEX_HULL", 0, "Convex Hull", ""},
{OB_BOUND_POLYH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""},
{OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
//{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
{0, NULL, 0, NULL, NULL}};
@ -330,7 +329,6 @@ static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *C, PointerR
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_BOX);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE);
}
RNA_enum_item_end(&item, &totitem);
@ -1445,7 +1443,6 @@ static void rna_def_object(BlenderRNA *brna)
{OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""},
{OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
{OB_BOUND_CONE, "CONE", 0, "Cone", ""},
{OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
{OB_BOUND_POLYH, "POLYHEDER", 0, "Polyheder", ""},
{0, NULL, 0, NULL, NULL}};

View File

@ -402,4 +402,4 @@ PyObject *BLF_Init(void)
PyModule_AddIntConstant(submodule, "KERNING_DEFAULT", BLF_KERNING_DEFAULT);
return (submodule);
}
}

View File

@ -226,7 +226,7 @@
#define ISTWEAK(event) (event >= EVT_TWEAK_L && event <= EVT_GESTURE)
/* test whether event type is acceptable as hotkey, excluding modifiers */
#define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event)) && !(event>=LEFTCTRLKEY && event<=ESCKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
#define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event)) && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
/* **************** BLENDER GESTURE EVENTS ********************* */

View File

@ -1570,13 +1570,6 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
objprop.m_boundobject.c.m_height = 2.f*bb.m_extends[2];
break;
}
case OB_BOUND_CAPSULE:
{
objprop.m_boundclass = KX_BOUNDCAPSULE;
objprop.m_boundobject.c.m_radius = MT_max(bb.m_extends[0], bb.m_extends[1]);
objprop.m_boundobject.c.m_height = bb.m_extends[2];
break;
}
}
}
@ -2698,4 +2691,4 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
MT_Scalar distance = (activecam)? activecam->GetCameraFar() - activecam->GetCameraNear(): 100.0f;
RAS_BucketManager *bucketmanager = kxscene->GetBucketManager();
bucketmanager->OptimizeBuckets(distance);
}
}

View File

@ -932,7 +932,7 @@ Main* KX_BlenderSceneConverter::GetMainDynamicPath(const char *path)
return NULL;
}
bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, char *filter, KX_Scene *scene_merge, char **err_str)
bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, KX_Scene *scene_merge, char **err_str)
{
bContext *C;
Main *main_newlib; /* stored as a dynamic 'main' until we free it */
@ -941,7 +941,6 @@ bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, char
BlendHandle *bpy_openlib = NULL; /* ptr to the open .blend file */
int idcode= BLO_idcode_from_name(group);
short flag= 0; /* dont need any special options */
bool found = false; /* used for error reporting when using item */
ReportList reports;
static char err_local[255];
@ -950,48 +949,50 @@ bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, char
snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group);
return false;
}
main_newlib = GetMainDynamicPath(path);
if (main_newlib == NULL)
{
bpy_openlib = BLO_blendhandle_from_file( (char *)path );
if(bpy_openlib==NULL) {
snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path);
*err_str= err_local;
return false;
}
main_newlib= (Main *)MEM_callocN( sizeof(Main), "BgeMain");
C= CTX_create();
CTX_data_main_set(C, main_newlib);
BKE_reports_init(&reports, RPT_STORE);
/* here appending/linking starts */
main_tmp = BLO_library_append_begin(C, &bpy_openlib, (char *)path);
names = BLO_blendhandle_get_datablock_names( bpy_openlib, idcode);
int i=0;
LinkNode *n= names;
while(n) {
BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, idcode, 0);
n= (LinkNode *)n->next;
i++;
}
BLI_linklist_free(names, free); /* free linklist *and* each node's data */
BLO_library_append_end(C, main_tmp, &bpy_openlib, idcode, flag);
BLO_blendhandle_close(bpy_openlib);
CTX_free(C);
BKE_reports_clear(&reports);
/* done linking */
/* needed for lookups*/
GetMainDynamic().push_back(main_newlib);
strncpy(main_newlib->name, path, sizeof(main_newlib->name));
if(GetMainDynamicPath(path)) {
snprintf(err_local, sizeof(err_local), "blend file already open \"%s\"\n", path);
*err_str= err_local;
return false;
}
bpy_openlib = BLO_blendhandle_from_file( (char *)path );
if(bpy_openlib==NULL) {
snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path);
*err_str= err_local;
return false;
}
main_newlib= (Main *)MEM_callocN( sizeof(Main), "BgeMain");
C= CTX_create();
CTX_data_main_set(C, main_newlib);
BKE_reports_init(&reports, RPT_STORE);
/* here appending/linking starts */
main_tmp = BLO_library_append_begin(C, &bpy_openlib, (char *)path);
names = BLO_blendhandle_get_datablock_names( bpy_openlib, idcode);
int i=0;
LinkNode *n= names;
while(n) {
BLO_library_append_named_part(C, main_tmp, &bpy_openlib, (char *)n->link, idcode, 0);
n= (LinkNode *)n->next;
i++;
}
BLI_linklist_free(names, free); /* free linklist *and* each node's data */
BLO_library_append_end(C, main_tmp, &bpy_openlib, idcode, flag);
BLO_blendhandle_close(bpy_openlib);
CTX_free(C);
BKE_reports_clear(&reports);
/* done linking */
/* needed for lookups*/
GetMainDynamic().push_back(main_newlib);
strncpy(main_newlib->name, path, sizeof(main_newlib->name));
if(idcode==ID_ME) {
/* Convert all new meshes into BGE meshes */
@ -999,39 +1000,24 @@ bool KX_BlenderSceneConverter::LinkBlendFile(const char *path, char *group, char
KX_Scene *kx_scene= m_currentScene;
for(mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) {
/* If item is defined, use it to filter meshes */
if (!strcmp(filter, "") || !strcmp(filter, mesh->name+2))
{
found = true;
RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, NULL, scene_merge, this);
kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
}
RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, NULL, scene_merge, this);
kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
}
}
else if(idcode==ID_SCE) {
/* Merge all new linked in scene into the existing one */
ID *scene;
for(scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) {
/* If item is defined, use it to filter scenes */
if (!strcmp(filter, "") || !strcmp(filter, scene->name+2))
{
found = true;
printf("Loading scene: %s\n", scene->name+2);
/* merge into the base scene */
KX_Scene* other= m_ketsjiEngine->CreateScene((Scene *)scene);
scene_merge->MergeScene(other);
// RemoveScene(other); // Dont run this, it frees the entire scene converter data, just delete the scene
delete other;
}
printf("SceneName: %s\n", scene->name);
/* merge into the base scene */
KX_Scene* other= m_ketsjiEngine->CreateScene((Scene *)scene);
scene_merge->MergeScene(other);
// RemoveScene(other); // Dont run this, it frees the entire scene converter data, just delete the scene
delete other;
}
}
if (found == false)
{
printf("Item not found: %s\n", filter);
return false;
}
return true;
}

View File

@ -142,7 +142,7 @@ public:
struct Main* GetMainDynamicPath(const char *path);
vector<struct Main*> &GetMainDynamic();
bool LinkBlendFile(const char *path, char *group, char *filter, KX_Scene *scene_merge, char **err_str);
bool LinkBlendFile(const char *path, char *group, KX_Scene *scene_merge, char **err_str);
bool MergeScene(KX_Scene *to, KX_Scene *from);
RAS_MeshObject *ConvertMeshSpecial(KX_Scene* kx_scene, Main *maggie, const char *name);
bool FreeBlendFile(struct Main *maggie);

View File

@ -228,8 +228,7 @@ static HWND findGhostWindowHWND(GHOST_IWindow* window)
bool GPG_Application::startScreenSaverPreview(
HWND parentWindow,
const bool stereoVisual,
const int stereoMode,
const GHOST_TUns16 samples)
const int stereoMode)
{
bool success = false;
@ -241,7 +240,7 @@ bool GPG_Application::startScreenSaverPreview(
STR_String title = "";
m_mainWindow = fSystem->createWindow(title, 0, 0, windowWidth, windowHeight, GHOST_kWindowStateMinimized,
GHOST_kDrawingContextTypeOpenGL, stereoVisual, samples);
GHOST_kDrawingContextTypeOpenGL, stereoVisual);
if (!m_mainWindow) {
printf("error: could not create main window\n");
exit(-1);
@ -283,10 +282,9 @@ bool GPG_Application::startScreenSaverFullScreen(
int height,
int bpp,int frequency,
const bool stereoVisual,
const int stereoMode,
const GHOST_TUns16 samples)
const int stereoMode)
{
bool ret = startFullScreen(width, height, bpp, frequency, stereoVisual, stereoMode, samples);
bool ret = startFullScreen(width, height, bpp, frequency, stereoVisual, stereoMode);
if (ret)
{
HWND ghost_hwnd = findGhostWindowHWND(m_mainWindow);
@ -308,14 +306,13 @@ bool GPG_Application::startWindow(STR_String& title,
int windowWidth,
int windowHeight,
const bool stereoVisual,
const int stereoMode,
const GHOST_TUns16 samples)
const int stereoMode)
{
bool success;
// Create the main window
//STR_String title ("Blender Player - GHOST");
m_mainWindow = fSystem->createWindow(title, windowLeft, windowTop, windowWidth, windowHeight, GHOST_kWindowStateNormal,
GHOST_kDrawingContextTypeOpenGL, stereoVisual, samples);
GHOST_kDrawingContextTypeOpenGL, stereoVisual);
if (!m_mainWindow) {
printf("error: could not create main window\n");
exit(-1);
@ -337,11 +334,10 @@ bool GPG_Application::startWindow(STR_String& title,
bool GPG_Application::startEmbeddedWindow(STR_String& title,
const GHOST_TEmbedderWindowID parentWindow,
const bool stereoVisual,
const int stereoMode,
const GHOST_TUns16 samples) {
const int stereoMode) {
m_mainWindow = fSystem->createWindow(title, 0, 0, 0, 0, GHOST_kWindowStateNormal,
GHOST_kDrawingContextTypeOpenGL, stereoVisual,samples, parentWindow);
GHOST_kDrawingContextTypeOpenGL, stereoVisual, parentWindow);
if (!m_mainWindow) {
printf("error: could not create main window\n");
@ -362,8 +358,7 @@ bool GPG_Application::startFullScreen(
int height,
int bpp,int frequency,
const bool stereoVisual,
const int stereoMode,
const GHOST_TUns16 samples)
const int stereoMode)
{
bool success;
// Create the main window

View File

@ -59,12 +59,12 @@ public:
bool SetGameEngineData(struct Main* maggie, struct Scene* scene, int argc, char** argv);
bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight,
const bool stereoVisual, const int stereoMode, const GHOST_TUns16 numOfAASamples = 0);
bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0);
bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0);
const bool stereoVisual, const int stereoMode);
bool startFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode);
bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, const bool stereoVisual, const int stereoMode);
#ifdef WIN32
bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0);
bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0);
bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, const bool stereoVisual, const int stereoMode);
bool startScreenSaverPreview(HWND parentWindow, const bool stereoVisual, const int stereoMode);
#endif
virtual bool processEvent(GHOST_IEvent* event);

View File

@ -214,7 +214,6 @@ void usage(const char* program)
printf(" -c: keep console window open\n\n");
#endif
printf(" -d: turn debugging on\n\n");
printf(" -m: sets the number of samples to request for multisampling");
printf(" -g: game engine options:\n\n");
printf(" Name Default Description\n");
printf(" ------------------------------------------------------------------------\n");
@ -230,7 +229,6 @@ void usage(const char* program)
printf("\n");
printf("example: %s -w 320 200 10 10 -g noaudio c:\\loadtest.blend\n", program);
printf("example: %s -g show_framerate = 0 c:\\loadtest.blend\n", program);
printf("example: %s -m 4 game.blend", program);
}
static void get_filename(int argc, char **argv, char *filename)
@ -336,7 +334,6 @@ int main(int argc, char** argv)
int windowHeight = 480;
GHOST_TUns32 fullScreenWidth = 0;
GHOST_TUns32 fullScreenHeight= 0;
GHOST_TUns16 aaSamples = 4;
int fullScreenBpp = 32;
int fullScreenFrequency = 60;
GHOST_TEmbedderWindowID parentWindow = 0;
@ -511,12 +508,6 @@ int main(int argc, char** argv)
}
}
break;
case 'm':
i++;
if ((i+1) < argc)
aaSamples = atoi(argv[i++]);
break;
case 'h':
usage(argv[0]);
@ -819,13 +810,13 @@ int main(int argc, char** argv)
if (scr_saver_mode == SCREEN_SAVER_MODE_SAVER)
{
app.startScreenSaverFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency,
stereoWindow, stereomode, aaSamples);
stereoWindow, stereomode);
}
else
#endif
{
app.startFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency,
stereoWindow, stereomode, aaSamples);
stereoWindow, stereomode);
}
}
else
@ -865,16 +856,16 @@ int main(int argc, char** argv)
#ifdef WIN32
if (scr_saver_mode == SCREEN_SAVER_MODE_PREVIEW)
{
app.startScreenSaverPreview(scr_saver_hwnd, stereoWindow, stereomode, aaSamples);
app.startScreenSaverPreview(scr_saver_hwnd, stereoWindow, stereomode);
}
else
#endif
{
if (parentWindow != 0)
app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode, aaSamples);
app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode);
else
app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight,
stereoWindow, stereomode, aaSamples);
stereoWindow, stereomode);
}
}
}

View File

@ -69,10 +69,6 @@ ELSE(WITH_SDL)
ADD_DEFINITIONS(-DDISABLE_SDL)
ENDIF(WITH_SDL)
if(WITH_DDS)
ADD_DEFINITIONS(-DWITH_DDS)
ENDIF(WITH_DDS)
IF(WITH_PYTHON)
SET(INC ${INC} ${PYTHON_INC})
ELSE(WITH_PYTHON)

View File

@ -53,8 +53,7 @@ typedef enum {
KX_BOUNDCONE,
KX_BOUNDMESH,
KX_BOUNDPOLYTOPE,
KX_BOUND_DYN_MESH,
KX_BOUNDCAPSULE
KX_BOUND_DYN_MESH
} KX_BoundBoxClass;
struct KX_BoxBounds

View File

@ -184,14 +184,6 @@ void KX_ConvertBulletObject( class KX_GameObject* gameobj,
bm = shapeInfo->CreateBulletShape(ci.m_margin);
break;
}
case KX_BOUNDCAPSULE:
{
shapeInfo->m_radius = objprop->m_boundobject.c.m_radius;
shapeInfo->m_height = objprop->m_boundobject.c.m_height;
shapeInfo->m_shapeType = PHY_SHAPE_CAPSULE;
bm = shapeInfo->CreateBulletShape(ci.m_margin);
break;
}
case KX_BOUNDMESH:
{
// mesh shapes can be shared, check first if we already have a shape on that mesh

View File

@ -628,13 +628,12 @@ static PyObject *gLibLoad(PyObject*, PyObject* args)
KX_Scene *kx_scene= gp_KetsjiScene;
char *path;
char *group;
char *filter= "";
char *err_str= NULL;
if (!PyArg_ParseTuple(args,"ss|s:LibLoad",&path, &group, &filter))
if (!PyArg_ParseTuple(args,"ss:LibLoad",&path, &group))
return NULL;
if(kx_scene->GetSceneConverter()->LinkBlendFile(path, group, filter, kx_scene, &err_str)) {
if(kx_scene->GetSceneConverter()->LinkBlendFile(path, group, kx_scene, &err_str)) {
Py_RETURN_TRUE;
}

View File

@ -23,9 +23,6 @@ incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #
incs += ' ' + env['BF_BULLET_INC']
incs += ' ' + env['BF_OPENGL_INC']
if env['WITH_BF_DDS']:
defs.append('WITH_DDS')
if env['WITH_BF_SDL']:
incs += ' ' + env['BF_SDL_INC']
else:

View File

@ -2027,11 +2027,6 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b
collisionShape->setMargin(margin);
break;
case PHY_SHAPE_CAPSULE:
collisionShape = new btCapsuleShapeZ(m_radius, m_height);
collisionShape->setMargin(margin);
break;
case PHY_SHAPE_MESH:
// Let's use the latest btScaledBvhTriangleMeshShape: it allows true sharing of
// triangle mesh information between duplicates => drastic performance increase when

View File

@ -138,7 +138,6 @@ typedef enum PHY_ShapeType {
PHY_SHAPE_SPHERE,
PHY_SHAPE_CYLINDER,
PHY_SHAPE_CONE,
PHY_SHAPE_CAPSULE,
PHY_SHAPE_MESH,
PHY_SHAPE_POLYTOPE,
PHY_SHAPE_COMPOUND,

View File

@ -194,15 +194,6 @@ void RAS_2DFilterManager::AnalyseShader(int passindex, vector<STR_String>& propN
{
texflag[passindex] |= 0x2;
}
if(glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredRenderTexture") != -1)
{
texflag[passindex] |= 0x4;
}
if(glGetUniformLocationARB(m_filters[passindex], "bgl_QuartedDepthTexture") != -1)
{
if(GLEW_ARB_depth_texture)
texflag[passindex] |= 0x8;
}
if(m_gameObjects[passindex])
{
@ -250,29 +241,6 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex)
glUniform1iARB(uniformLoc, 2);
}
}
/* Send the quartered render texture to glsl program if it needs */
if(texflag[passindex] & 0x4){
uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredRenderTexture");
glActiveTextureARB(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, texname[3]);
if (uniformLoc != -1)
{
glUniform1iARB(uniformLoc, 3);
}
}
if(texflag[passindex] & 0x5){
uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_QuarteredDepthTexture");
glActiveTextureARB(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, texname[4]);
if (uniformLoc != -1)
{
glUniform1iARB(uniformLoc, 4);
}
}
uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_TextureCoordinateOffset");
if (uniformLoc != -1)
@ -309,24 +277,15 @@ void RAS_2DFilterManager::EndShaderProgram()
void RAS_2DFilterManager::FreeTextures()
{
// Update this when adding new textures!
for (int i=0; i<5; i++)
{
if(texname[i]!=(unsigned int)-1)
glDeleteTextures(1, (GLuint*)&texname[i]);
}
if(fbo != (unsigned int)-1)
glDeleteFramebuffersEXT(1, &fbo);
/*if(texname[0]!=(unsigned int)-1)
if(texname[0]!=(unsigned int)-1)
glDeleteTextures(1, (GLuint*)&texname[0]);
if(texname[1]!=(unsigned int)-1)
glDeleteTextures(1, (GLuint*)&texname[1]);
if(texname[2]!=(unsigned int)-1)
glDeleteTextures(1, (GLuint*)&texname[2]);*/
glDeleteTextures(1, (GLuint*)&texname[2]);
}
void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance, bool qrender, bool qdepth)
void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance)
{
FreeTextures();
@ -362,25 +321,6 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance, bool qrender
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
if(qrender){
glGenTextures(1, (GLuint*)&texname[3]);
glBindTexture(GL_TEXTURE_2D, texname[3]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texturewidth/2, textureheight/2, 0, GL_RGBA8,
GL_UNSIGNED_BYTE, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glGenFramebuffersEXT(1, &fbo);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, texname[3], 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
}
void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas)
@ -437,8 +377,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
{
bool need_depth=false;
bool need_luminance=false;
bool need_qrender=false;
bool need_qdepth=false;
int num_filters = 0;
int passindex;
@ -454,11 +392,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
need_depth = true;
if(texflag[passindex] & 0x2)
need_luminance = true;
if(texflag[passindex] & 0x4)
need_qrender = true;
if(texflag[passindex] & 0x8)
need_qdepth = true;
if(need_depth && need_luminance && need_qrender && need_qdepth)
if(need_depth && need_luminance)
break;
}
}
@ -478,7 +412,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
if(need_tex_update)
{
SetupTextures(need_depth, need_luminance, need_qrender, need_qdepth);
SetupTextures(need_depth, need_luminance);
need_tex_update = false;
}
@ -494,12 +428,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0);
}
if(need_qdepth){
glActiveTextureARB(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, texname[4]);
glCopyTexImage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT, 0, 0, texturewidth, textureheight, 0);
}
glViewport(0,0, texturewidth, textureheight);
glDisable(GL_DEPTH_TEST);
@ -520,53 +448,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
glActiveTextureARB(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texname[0]);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, texturewidth, textureheight, 0);
//glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, im_buff);
if(need_qrender){
//glActiveTextureARB(GL_TEXTURE3);
//glBindTexture(GL_TEXTURE_2D, texname[3]);
//glReadPixels(0, 0, texturewidth, textureheight, GL_RGB, GL_UNSIGNED_BYTE, im_buff);
//gluScaleImage(GL_RGB, texturewidth, textureheight, GL_UNSIGNED_BYTE, im_buff,
// texturewidth/2, textureheight/2, GL_UNSIGNED_BYTE, scaled_buff);
//glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texturewidth, textureheight, GL_RGBA, GL_UNSIGNED_BYTE, im_buff);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
if(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT) {
glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT);
glViewport(0, 0, texturewidth/2, textureheight/2);
/* glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0, texturewidth/2, 0, textureheight/2);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();*/
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
/*glBindTexture(GL_TEXTURE_2D, texname[0]);
glBegin(GL_QUADS);
glColor4f(0.f, 1.f, 1.f, 1.f);
glTexCoord2f(1.f, 1.f); glVertex2f(1,1);
glTexCoord2f(0.f, 1.f); glVertex2f(-1,1);
glTexCoord2f(0.f, 0.f); glVertex2f(-1,-1);
glTexCoord2f(1.f, 0.f); glVertex2f(1,-1);
glEnd();*/
glFlush();
//glPopMatrix();
//glMatrixMode(GL_PROJECTION);
//glPopMatrix();
glPopAttrib();
} else {
printf("Could not use the framebuffer\n");
}
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
glClearColor(1, 0, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);

View File

@ -45,7 +45,7 @@ private:
void EndShaderProgram();
void PrintShaderErrors(unsigned int shader, const char *task, const char *code);
void SetupTextures(bool depth, bool luminance, bool qrender, bool qdepth);
void SetupTextures(bool depth, bool luminance);
void FreeTextures();
void UpdateOffsetMatrix(RAS_ICanvas* canvas);
@ -54,15 +54,13 @@ private:
float canvascoord[4];
float textureoffsets[18];
float view[4];
/* texname[0] contains render to texture, texname[1] contains depth texture, texname[2] contains luminance texture
* texname[3] contains quartered render to texture, texname[4] contains quartered depth texture*/
unsigned int texname[5];
/* texname[0] contains render to texture, texname[1] contains depth texture, texname[2] contains luminance texture*/
unsigned int texname[3];
int texturewidth;
int textureheight;
int canvaswidth;
int canvasheight;
int numberoffilters;
unsigned int fbo;
/* bit 0: enable/disable depth texture
* bit 1: enable/disable luminance texture*/
short texflag[MAX_RENDER_PASS];

View File

@ -297,7 +297,6 @@ bool RAS_OpenGLRasterizer::BeginFrame(int drawingmode, double time)
m_last_frontface = true;
glShadeModel(GL_SMOOTH);
glEnable(GL_MULTISAMPLE_ARB);
m_2DCanvas->BeginFrame();
@ -383,7 +382,6 @@ void RAS_OpenGLRasterizer::EndFrame()
FlushDebugLines();
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDisable(GL_MULTISAMPLE_ARB);
m_2DCanvas->EndFrame();
}