style cleanup

This commit is contained in:
2012-07-21 22:58:08 +00:00
parent 049dd8a0ff
commit 9b51503307
42 changed files with 304 additions and 288 deletions

View File

@@ -117,7 +117,7 @@ Patch *SubdAccBuilder::run(SubdFace *face)
memcpy(patch->hull, position, sizeof(float3)*20); memcpy(patch->hull, position, sizeof(float3)*20);
return patch; return patch;
} }
else if(face->num_edges() == 4) { else if(face->num_edges() == 4) {
GregoryQuadPatch *patch = new GregoryQuadPatch(); GregoryQuadPatch *patch = new GregoryQuadPatch();
memcpy(patch->hull, position, sizeof(float3)*20); memcpy(patch->hull, position, sizeof(float3)*20);
return patch; return patch;
@@ -644,7 +644,7 @@ Patch *SubdLinearBuilder::run(SubdFace *face)
hull = lpatch->hull; hull = lpatch->hull;
patch = lpatch; patch = lpatch;
} }
else if(face->num_edges() == 4) { else if(face->num_edges() == 4) {
LinearQuadPatch *lpatch = new LinearQuadPatch(); LinearQuadPatch *lpatch = new LinearQuadPatch();
hull = lpatch->hull; hull = lpatch->hull;
patch = lpatch; patch = lpatch;

View File

@@ -174,7 +174,7 @@ BuildQuadrics(
vector<LOD_Edge>::iterator edge_it = edges.begin(); vector<LOD_Edge>::iterator edge_it = edges.begin();
vector<LOD_Edge>::const_iterator edge_end = edges.end(); vector<LOD_Edge>::const_iterator edge_end = edges.end();
for (; edge_it != edge_end; ++edge_it) { for (; edge_it != edge_end; ++edge_it) {
MT_Vector3 target = TargetVertex(*edge_it); MT_Vector3 target = TargetVertex(*edge_it);
@@ -235,7 +235,7 @@ ComputeEdgeCosts(
vector<LOD_EdgeInd>::const_iterator edge_it = edges.begin(); vector<LOD_EdgeInd>::const_iterator edge_it = edges.begin();
vector<LOD_EdgeInd>::const_iterator edge_end = edges.end(); vector<LOD_EdgeInd>::const_iterator edge_end = edges.end();
for (; edge_it != edge_end; ++edge_it) { for (; edge_it != edge_end; ++edge_it) {
MT_Vector3 target = TargetVertex(edge_set[*edge_it]); MT_Vector3 target = TargetVertex(edge_set[*edge_it]);

View File

@@ -48,7 +48,7 @@ GHOST_DisplayManagerX11(
GHOST_DisplayManager(), GHOST_DisplayManager(),
m_system(system) m_system(system)
{ {
//nothing to do. /* nothing to do. */
} }
GHOST_TSuccess GHOST_TSuccess
@@ -87,7 +87,7 @@ getNumDisplaySettings(
XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes); XF86VidModeGetAllModeLines(dpy, DefaultScreen(dpy), &numSettings, &vidmodes);
#else #else
// We only have one X11 setting at the moment. /* We only have one X11 setting at the moment. */
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n"); GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
numSettings = GHOST_TInt32(1); numSettings = GHOST_TInt32(1);
#endif #endif
@@ -144,8 +144,8 @@ getDisplaySetting(
setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display)); setting.bpp = DefaultDepth(x_display, DefaultScreen(x_display));
#endif #endif
// Don't think it's possible to get this value from X! /* Don't think it's possible to get this value from X!
// So let's guess!! * So let's guess!! */
setting.frequency = 60; setting.frequency = 60;
return GHOST_kSuccess; return GHOST_kSuccess;
@@ -171,11 +171,10 @@ setCurrentDisplaySetting(
const GHOST_DisplaySetting& setting) const GHOST_DisplaySetting& setting)
{ {
#ifdef WITH_X11_XF86VMODE #ifdef WITH_X11_XF86VMODE
// /* Mode switching code ported from Quake 2:
// Mode switching code ported from Quake 2: * ftp:/* ftp.idsoftware.com/idstuff/source/q2source-3.21.zip */
// ftp://ftp.idsoftware.com/idstuff/source/q2source-3.21.zip * See linux/gl_glx.c:GLimp_SetMode
// See linux/gl_glx.c:GLimp_SetMode */
//
int majorVersion, minorVersion; int majorVersion, minorVersion;
XF86VidModeModeInfo **vidmodes; XF86VidModeModeInfo **vidmodes;
Display *dpy = m_system->getXDisplay(); Display *dpy = m_system->getXDisplay();
@@ -187,7 +186,7 @@ setCurrentDisplaySetting(
scrnum = DefaultScreen(dpy); scrnum = DefaultScreen(dpy);
// Get video mode list /* Get video mode list */
majorVersion = minorVersion = 0; majorVersion = minorVersion = 0;
if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) { if (!XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion)) {
fprintf(stderr, "Error: XF86VidMode extension missing!\n"); fprintf(stderr, "Error: XF86VidMode extension missing!\n");
@@ -228,20 +227,21 @@ setCurrentDisplaySetting(
actualWidth, actualHeight); actualWidth, actualHeight);
# endif # endif
// change to the mode /* change to the mode */
XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]); XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[best_fit]);
// Move the viewport to top left /* Move the viewport to top left */
XF86VidModeSetViewPort(dpy, scrnum, 0, 0); XF86VidModeSetViewPort(dpy, scrnum, 0, 0);
} }
else else {
return GHOST_kFailure; return GHOST_kFailure;
}
XFlush(dpy); XFlush(dpy);
return GHOST_kSuccess; return GHOST_kSuccess;
#else #else
// Just pretend the request was successful. /* Just pretend the request was successful. */
return GHOST_kSuccess; return GHOST_kSuccess;
#endif #endif
} }

View File

@@ -144,23 +144,23 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char
break; break;
} }
// We are now converting /* We are now converting */
state = STATE_CONVERTING; state = STATE_CONVERTING;
break; break;
case STATE_CONVERTING: case STATE_CONVERTING:
bothDigits = true; bothDigits = true;
// Create a buffer to hold the hex. For example, if %20, this /* Create a buffer to hold the hex. For example, if %20, this
// buffer would hold 20 (in ASCII) * buffer would hold 20 (in ASCII) */
memset(tempNumBuf, 0, sizeof(tempNumBuf)); memset(tempNumBuf, 0, sizeof(tempNumBuf));
// Conversion complete (i.e. don't convert again next iter) /* Conversion complete (i.e. don't convert again next iter) */
state = STATE_SEARCH; state = STATE_SEARCH;
strncpy(tempNumBuf, &encodedIn[i], 2); strncpy(tempNumBuf, &encodedIn[i], 2);
// Ensure both characters are hexadecimal /* Ensure both characters are hexadecimal */
for (j = 0; j < 2; ++j) { for (j = 0; j < 2; ++j) {
if (!isxdigit(tempNumBuf[j])) if (!isxdigit(tempNumBuf[j]))
@@ -170,16 +170,16 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char
if (!bothDigits) if (!bothDigits)
break; break;
// Convert two hexadecimal characters into one character /* Convert two hexadecimal characters into one character */
sscanf(tempNumBuf, "%x", &asciiCharacter); sscanf(tempNumBuf, "%x", &asciiCharacter);
// Ensure we aren't going to overflow /* Ensure we aren't going to overflow */
assert(strlen(decodedOut) < bufferSize); assert(strlen(decodedOut) < bufferSize);
// Concatenate this character onto the output /* Concatenate this character onto the output */
strncat(decodedOut, (char *)&asciiCharacter, 1); strncat(decodedOut, (char *)&asciiCharacter, 1);
// Skip the next character /* Skip the next character */
i++; i++;
break; break;
} }

View File

@@ -38,11 +38,11 @@
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> // for fprintf only #include <stdio.h> /* for fprintf only */
#include <cstdlib> // for exit #include <cstdlib> /* for exit */
#include <pwd.h> // for get home without use getenv() #include <pwd.h> /* for get home without use getenv() */
#include <limits.h> // for PATH_MAX #include <limits.h> /* for PATH_MAX */
#ifdef PREFIX #ifdef PREFIX
static const char *static_path = PREFIX "/share"; static const char *static_path = PREFIX "/share";

View File

@@ -32,7 +32,6 @@
* \ingroup GHOST * \ingroup GHOST
*/ */
#include "GHOST_SystemX11.h" #include "GHOST_SystemX11.h"
#include "GHOST_WindowX11.h" #include "GHOST_WindowX11.h"
#include "GHOST_WindowManager.h" #include "GHOST_WindowManager.h"
@@ -44,11 +43,11 @@
#include "GHOST_DisplayManagerX11.h" #include "GHOST_DisplayManagerX11.h"
#include "GHOST_EventDragnDrop.h" #include "GHOST_EventDragnDrop.h"
#ifdef WITH_INPUT_NDOF #ifdef WITH_INPUT_NDOF
#include "GHOST_NDOFManagerX11.h" # include "GHOST_NDOFManagerX11.h"
#endif #endif
#ifdef WITH_XDND #ifdef WITH_XDND
#include "GHOST_DropTargetX11.h" # include "GHOST_DropTargetX11.h"
#endif #endif
#include "GHOST_Debug.h" #include "GHOST_Debug.h"
@@ -61,20 +60,19 @@
#include <X11/XF86keysym.h> #include <X11/XF86keysym.h>
#endif #endif
// For timing /* For timing */
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <stdio.h> // for fprintf only #include <stdio.h> /* for fprintf only */
#include <cstdlib> // for exit #include <cstdlib> /* for exit */
static GHOST_TKey static GHOST_TKey
convertXKey(KeySym key); convertXKey(KeySym key);
//these are for copy and select copy /* these are for copy and select copy */
static char *txt_cut_buffer = NULL; static char *txt_cut_buffer = NULL;
static char *txt_select_buffer = NULL; static char *txt_select_buffer = NULL;
@@ -90,7 +88,7 @@ GHOST_SystemX11(
if (!m_display) { if (!m_display) {
std::cerr << "Unable to open a display" << std::endl; std::cerr << "Unable to open a display" << std::endl;
abort(); //was return before, but this would just mean it will crash later abort(); /* was return before, but this would just mean it will crash later */
} }
#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
@@ -128,13 +126,13 @@ GHOST_SystemX11(
m_last_warp = 0; m_last_warp = 0;
// compute the initial time /* compute the initial time */
timeval tv; timeval tv;
if (gettimeofday(&tv, NULL) == -1) { if (gettimeofday(&tv, NULL) == -1) {
GHOST_ASSERT(false, "Could not instantiate timer!"); GHOST_ASSERT(false, "Could not instantiate timer!");
} }
// Taking care not to overflow the tv.tv_sec*1000 /* Taking care not to overflow the tv.tv_sec*1000 */
m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000; m_start_time = GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000;
@@ -190,7 +188,7 @@ getMilliSeconds() const
GHOST_ASSERT(false, "Could not compute time!"); GHOST_ASSERT(false, "Could not compute time!");
} }
// Taking care not to overflow the tv.tv_sec*1000 /* Taking care not to overflow the tv.tv_sec*1000 */
return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time; return GHOST_TUns64(tv.tv_sec) * 1000 + tv.tv_usec / 1000 - m_start_time;
} }
@@ -254,16 +252,16 @@ createWindow(
window = new GHOST_WindowX11( window = new GHOST_WindowX11(this, m_display, title,
this, m_display, title, left, top, width, height, state, parentWindow, type, stereoVisual left, top, width, height,
); state, parentWindow, type, stereoVisual);
if (window) { if (window) {
// Both are now handle in GHOST_WindowX11.cpp /* Both are now handle in GHOST_WindowX11.cpp
// Focus and Delete atoms. * Focus and Delete atoms. */
if (window->getValid()) { if (window->getValid()) {
// Store the pointer to the window /* Store the pointer to the window */
m_windowManager->addWindow(window); m_windowManager->addWindow(window);
m_windowManager->setActiveWindow(window); m_windowManager->setActiveWindow(window);
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
@@ -313,10 +311,10 @@ findGhostWindow(
if (xwind == 0) return NULL; if (xwind == 0) return NULL;
// It is not entirely safe to do this as the backptr may point /* It is not entirely safe to do this as the backptr may point
// to a window that has recently been removed. * to a window that has recently been removed.
// We should always check the window manager's list of windows * We should always check the window manager's list of windows
// and only process events on these windows. * and only process events on these windows. */
vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows(); vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
@@ -411,8 +409,8 @@ GHOST_SystemX11::
processEvents( processEvents(
bool waitForEvent) bool waitForEvent)
{ {
// Get all the current events -- translate them into /* Get all the current events -- translate them into
// ghost events and call base class pushEvent() method. * ghost events and call base class pushEvent() method. */
bool anyProcessed = false; bool anyProcessed = false;
@@ -519,8 +517,8 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XExposeEvent & xee = xe->xexpose; XExposeEvent & xee = xe->xexpose;
if (xee.count == 0) { if (xee.count == 0) {
// Only generate a single expose event /* Only generate a single expose event
// per read of the event queue. * per read of the event queue. */
g_event = new g_event = new
GHOST_Event( GHOST_Event(
@@ -761,7 +759,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
break; break;
} }
// change of size, border, layer etc. /* change of size, border, layer etc. */
case ConfigureNotify: case ConfigureNotify:
{ {
/* XConfigureEvent & xce = xe->xconfigure; */ /* XConfigureEvent & xce = xe->xconfigure; */
@@ -780,12 +778,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
{ {
XFocusChangeEvent &xfe = xe->xfocus; XFocusChangeEvent &xfe = xe->xfocus;
// TODO: make sure this is the correct place for activate/deactivate /* TODO: make sure this is the correct place for activate/deactivate */
// printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window); // printf("X: focus %s for window %d\n", xfe.type == FocusIn ? "in" : "out", (int) xfe.window);
// May have to look at the type of event and filter some /* May have to look at the type of event and filter some out. */
// out.
GHOST_TEventType gtype = (xfe.type == FocusIn) ? GHOST_TEventType gtype = (xfe.type == FocusIn) ?
GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate; GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate;
@@ -860,7 +857,7 @@ GHOST_SystemX11::processEvent(XEvent *xe)
case DestroyNotify: case DestroyNotify:
::exit(-1); ::exit(-1);
// We're not interested in the following things.(yet...) /* We're not interested in the following things.(yet...) */
case NoExpose: case NoExpose:
case GraphicsExpose: case GraphicsExpose:
break; break;
@@ -945,8 +942,12 @@ GHOST_SystemX11::processEvent(XEvent *xe)
nxe.xselection.target = xse->target; nxe.xselection.target = xse->target;
nxe.xselection.time = xse->time; nxe.xselection.time = xse->time;
/*Check to see if the requestor is asking for String*/ /* Check to see if the requestor is asking for String */
if (xse->target == utf8_string || xse->target == string || xse->target == compound_text || xse->target == c_string) { if (xse->target == utf8_string ||
xse->target == string ||
xse->target == compound_text ||
xse->target == c_string)
{
if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) { if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) {
XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace,
(unsigned char *)txt_select_buffer, strlen(txt_select_buffer)); (unsigned char *)txt_select_buffer, strlen(txt_select_buffer));
@@ -968,11 +969,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
XFlush(m_display); XFlush(m_display);
} }
else { else {
//Change property to None because we do not support anything but STRING /* Change property to None because we do not support anything but STRING */
nxe.xselection.property = None; nxe.xselection.property = None;
} }
//Send the event to the client 0 0 == False, SelectionNotify /* Send the event to the client 0 0 == False, SelectionNotify */
XSendEvent(m_display, xse->requestor, 0, 0, &nxe); XSendEvent(m_display, xse->requestor, 0, 0, &nxe);
XFlush(m_display); XFlush(m_display);
break; break;
@@ -1023,14 +1024,14 @@ getModifierKeys(
GHOST_ModifierKeys& keys) const GHOST_ModifierKeys& keys) const
{ {
// analyse the masks retuned from XQueryPointer. /* analyse the masks retuned from XQueryPointer. */
memset((void *)m_keyboard_vector, 0, sizeof(m_keyboard_vector)); memset((void *)m_keyboard_vector, 0, sizeof(m_keyboard_vector));
XQueryKeymap(m_display, (char *)m_keyboard_vector); XQueryKeymap(m_display, (char *)m_keyboard_vector);
// now translate key symobols into keycodes and /* now translate key symobols into keycodes and
// test with vector. * test with vector. */
const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L); const static KeyCode shift_l = XKeysymToKeycode(m_display, XK_Shift_L);
const static KeyCode shift_r = XKeysymToKeycode(m_display, XK_Shift_R); const static KeyCode shift_r = XKeysymToKeycode(m_display, XK_Shift_R);
@@ -1041,16 +1042,16 @@ getModifierKeys(
const static KeyCode super_l = XKeysymToKeycode(m_display, XK_Super_L); const static KeyCode super_l = XKeysymToKeycode(m_display, XK_Super_L);
const static KeyCode super_r = XKeysymToKeycode(m_display, XK_Super_R); const static KeyCode super_r = XKeysymToKeycode(m_display, XK_Super_R);
// shift /* shift */
keys.set(GHOST_kModifierKeyLeftShift, ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyLeftShift, ((m_keyboard_vector[shift_l >> 3] >> (shift_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightShift, ((m_keyboard_vector[shift_r >> 3] >> (shift_r & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightShift, ((m_keyboard_vector[shift_r >> 3] >> (shift_r & 7)) & 1) != 0);
// control /* control */
keys.set(GHOST_kModifierKeyLeftControl, ((m_keyboard_vector[control_l >> 3] >> (control_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyLeftControl, ((m_keyboard_vector[control_l >> 3] >> (control_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightControl, ((m_keyboard_vector[control_r >> 3] >> (control_r & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightControl, ((m_keyboard_vector[control_r >> 3] >> (control_r & 7)) & 1) != 0);
// alt /* alt */
keys.set(GHOST_kModifierKeyLeftAlt, ((m_keyboard_vector[alt_l >> 3] >> (alt_l & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyLeftAlt, ((m_keyboard_vector[alt_l >> 3] >> (alt_l & 7)) & 1) != 0);
keys.set(GHOST_kModifierKeyRightAlt, ((m_keyboard_vector[alt_r >> 3] >> (alt_r & 7)) & 1) != 0); keys.set(GHOST_kModifierKeyRightAlt, ((m_keyboard_vector[alt_r >> 3] >> (alt_r & 7)) & 1) != 0);
// super (windows) - only one GHOST-kModifierKeyOS, so mapping to either /* super (windows) - only one GHOST-kModifierKeyOS, so mapping to either */
keys.set(GHOST_kModifierKeyOS, ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) || keys.set(GHOST_kModifierKeyOS, ( ((m_keyboard_vector[super_l >> 3] >> (super_l & 7)) & 1) ||
((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) != 0); ((m_keyboard_vector[super_r >> 3] >> (super_r & 7)) & 1) ) != 0);
@@ -1123,9 +1124,9 @@ setCursorPosition(
GHOST_TInt32 y GHOST_TInt32 y
) { ) {
// This is a brute force move in screen coordinates /* This is a brute force move in screen coordinates
// XWarpPointer does relative moves so first determine the * XWarpPointer does relative moves so first determine the
// current pointer position. * current pointer position. */
int cx, cy; int cx, cy;
if (getCursorPosition(cx, cy) == GHOST_kFailure) { if (getCursorPosition(cx, cy) == GHOST_kFailure) {
@@ -1336,15 +1337,15 @@ convertXKey(KeySym key)
/* from xclip.c xcout() v0.11 */ /* from xclip.c xcout() v0.11 */
#define XCLIB_XCOUT_NONE 0 /* no context */ #define XCLIB_XCOUT_NONE 0 /* no context */
#define XCLIB_XCOUT_SENTCONVSEL 1 /* sent a request */ #define XCLIB_XCOUT_SENTCONVSEL 1 /* sent a request */
#define XCLIB_XCOUT_INCR 2 /* in an incr loop */ #define XCLIB_XCOUT_INCR 2 /* in an incr loop */
#define XCLIB_XCOUT_FALLBACK 3 /* STRING failed, need fallback to UTF8 */ #define XCLIB_XCOUT_FALLBACK 3 /* STRING failed, need fallback to UTF8 */
#define XCLIB_XCOUT_FALLBACK_UTF8 4 /* UTF8 failed, move to compouned */ #define XCLIB_XCOUT_FALLBACK_UTF8 4 /* UTF8 failed, move to compouned */
#define XCLIB_XCOUT_FALLBACK_COMP 5 /* compouned failed, move to text. */ #define XCLIB_XCOUT_FALLBACK_COMP 5 /* compouned failed, move to text. */
#define XCLIB_XCOUT_FALLBACK_TEXT 6 #define XCLIB_XCOUT_FALLBACK_TEXT 6
// Retrieves the contents of a selections. /* Retrieves the contents of a selections. */
void GHOST_SystemX11::getClipboard_xcout(XEvent evt, void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
Atom sel, Atom target, unsigned char **txt, Atom sel, Atom target, unsigned char **txt,
unsigned long *len, unsigned int *context) const unsigned long *len, unsigned int *context) const
@@ -1361,15 +1362,15 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
Window win = window->getXWindow(); Window win = window->getXWindow();
switch (*context) { switch (*context) {
// There is no context, do an XConvertSelection() /* There is no context, do an XConvertSelection() */
case XCLIB_XCOUT_NONE: case XCLIB_XCOUT_NONE:
// Initialise return length to 0 /* Initialise return length to 0 */
if (*len > 0) { if (*len > 0) {
free(*txt); free(*txt);
*len = 0; *len = 0;
} }
// Send a selection request /* Send a selection request */
XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime); XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime);
*context = XCLIB_XCOUT_SENTCONVSEL; *context = XCLIB_XCOUT_SENTCONVSEL;
return; return;
@@ -1391,22 +1392,22 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
return; return;
} }
// find the size and format of the data in property /* find the size and format of the data in property */
XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False, XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, &buffer); &pty_items, &pty_size, &buffer);
XFree(buffer); XFree(buffer);
if (pty_type == m_incr) { if (pty_type == m_incr) {
// start INCR mechanism by deleting property /* start INCR mechanism by deleting property */
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
XFlush(m_display); XFlush(m_display);
*context = XCLIB_XCOUT_INCR; *context = XCLIB_XCOUT_INCR;
return; return;
} }
// if it's not incr, and not format == 8, then there's /* if it's not incr, and not format == 8, then there's
// nothing in the selection (that xclip understands, anyway) * nothing in the selection (that xclip understands, anyway) */
if (pty_format != 8) { if (pty_format != 8) {
*context = XCLIB_XCOUT_NONE; *context = XCLIB_XCOUT_NONE;
@@ -1418,73 +1419,73 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
False, AnyPropertyType, &pty_type, False, AnyPropertyType, &pty_type,
&pty_format, &pty_items, &pty_size, &buffer); &pty_format, &pty_items, &pty_size, &buffer);
// finished with property, delete it /* finished with property, delete it */
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
// copy the buffer to the pointer for returned data /* copy the buffer to the pointer for returned data */
ltxt = (unsigned char *) malloc(pty_items); ltxt = (unsigned char *) malloc(pty_items);
memcpy(ltxt, buffer, pty_items); memcpy(ltxt, buffer, pty_items);
// set the length of the returned data /* set the length of the returned data */
*len = pty_items; *len = pty_items;
*txt = ltxt; *txt = ltxt;
// free the buffer /* free the buffer */
XFree(buffer); XFree(buffer);
*context = XCLIB_XCOUT_NONE; *context = XCLIB_XCOUT_NONE;
// complete contents of selection fetched, return 1 /* complete contents of selection fetched, return 1 */
return; return;
case XCLIB_XCOUT_INCR: case XCLIB_XCOUT_INCR:
// To use the INCR method, we basically delete the /* To use the INCR method, we basically delete the
// property with the selection in it, wait for an * property with the selection in it, wait for an
// event indicating that the property has been created, * event indicating that the property has been created,
// then read it, delete it, etc. * then read it, delete it, etc. */
// make sure that the event is relevant /* make sure that the event is relevant */
if (evt.type != PropertyNotify) if (evt.type != PropertyNotify)
return; return;
// skip unless the property has a new value /* skip unless the property has a new value */
if (evt.xproperty.state != PropertyNewValue) if (evt.xproperty.state != PropertyNewValue)
return; return;
// check size and format of the property /* check size and format of the property */
XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False, XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
AnyPropertyType, &pty_type, &pty_format, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer); &pty_items, &pty_size, (unsigned char **) &buffer);
if (pty_format != 8) { if (pty_format != 8) {
// property does not contain text, delete it /* property does not contain text, delete it
// to tell the other X client that we have read * to tell the other X client that we have read
// it and to send the next property * it and to send the next property */
XFree(buffer); XFree(buffer);
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
return; return;
} }
if (pty_size == 0) { if (pty_size == 0) {
// no more data, exit from loop /* no more data, exit from loop */
XFree(buffer); XFree(buffer);
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
*context = XCLIB_XCOUT_NONE; *context = XCLIB_XCOUT_NONE;
// this means that an INCR transfer is now /* this means that an INCR transfer is now
// complete, return 1 * complete, return 1 */
return; return;
} }
XFree(buffer); XFree(buffer);
// if we have come this far, the propery contains /* if we have come this far, the propery contains
// text, we know the size. * text, we know the size. */
XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size, XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
False, AnyPropertyType, &pty_type, &pty_format, False, AnyPropertyType, &pty_type, &pty_format,
&pty_items, &pty_size, (unsigned char **) &buffer); &pty_items, &pty_size, (unsigned char **) &buffer);
// allocate memory to accommodate data in *txt /* allocate memory to accommodate data in *txt */
if (*len == 0) { if (*len == 0) {
*len = pty_items; *len = pty_items;
ltxt = (unsigned char *) malloc(*len); ltxt = (unsigned char *) malloc(*len);
@@ -1494,13 +1495,13 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
ltxt = (unsigned char *) realloc(ltxt, *len); ltxt = (unsigned char *) realloc(ltxt, *len);
} }
// add data to ltxt /* add data to ltxt */
memcpy(&ltxt[*len - pty_items], buffer, pty_items); memcpy(&ltxt[*len - pty_items], buffer, pty_items);
*txt = ltxt; *txt = ltxt;
XFree(buffer); XFree(buffer);
// delete property to get the next item /* delete property to get the next item */
XDeleteProperty(m_display, win, m_xclip_out); XDeleteProperty(m_display, win, m_xclip_out);
XFlush(m_display); XFlush(m_display);
return; return;
@@ -1514,7 +1515,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
Atom target = m_utf8_string; Atom target = m_utf8_string;
Window owner; Window owner;
// from xclip.c doOut() v0.11 /* from xclip.c doOut() v0.11 */
unsigned char *sel_buf; unsigned char *sel_buf;
unsigned long sel_len = 0; unsigned long sel_len = 0;
XEvent evt; XEvent evt;

View File

@@ -81,9 +81,9 @@ protected:
GHOST_TSuccess activateDrawingContext( ) { return GHOST_kFailure; } GHOST_TSuccess activateDrawingContext( ) { return GHOST_kFailure; }
~GHOST_WindowNULL( ) { /* nothing */ } ~GHOST_WindowNULL( ) { /* nothing */ }
GHOST_TSuccess setWindowCursorVisibility( bool visible ) { return GHOST_kSuccess; } GHOST_TSuccess setWindowCursorVisibility( bool visible ) { return GHOST_kSuccess; }
GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; } GHOST_TSuccess setState(GHOST_TWindowState state) { return GHOST_kSuccess; }
GHOST_TWindowState getState() const { return GHOST_kWindowStateNormal; } GHOST_TWindowState getState() const { return GHOST_kWindowStateNormal; }
GHOST_TSuccess invalidate() { return GHOST_kSuccess; } GHOST_TSuccess invalidate() { return GHOST_kSuccess; }
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; }

View File

@@ -1343,7 +1343,7 @@ static int EnumPixelFormats(HDC hdc)
::DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd); ::DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
w = WeightPixelFormat(pfd); w = WeightPixelFormat(pfd);
// be strict on stereo // be strict on stereo
if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) { if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) {
if (w > weight) { if (w > weight) {
weight = w; weight = w;
iPixelFormat = i; iPixelFormat = i;

View File

@@ -39,7 +39,7 @@
#include "GHOST_DropTargetX11.h" #include "GHOST_DropTargetX11.h"
#endif #endif
// For standard X11 cursors /* For standard X11 cursors */
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
@@ -53,8 +53,8 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
// For obscure full screen mode stuuf /* For obscure full screen mode stuuf
// lifted verbatim from blut. * lifted verbatim from blut. */
typedef struct { typedef struct {
long flags; long flags;
@@ -95,7 +95,7 @@ typedef struct {
f.write('\n') f.write('\n')
*/ */
// See the python script above to regenerate the 48x48 icon within blender /* See the python script above to regenerate the 48x48 icon within blender */
#define BLENDER_ICON_WIDTH 48 #define BLENDER_ICON_WIDTH 48
#define BLENDER_ICON_HEIGHT 48 #define BLENDER_ICON_HEIGHT 48
static unsigned char BLENDER_ICON_48x48x24[] = { static unsigned char BLENDER_ICON_48x48x24[] = {
@@ -178,13 +178,13 @@ GHOST_WindowX11(
m_custom_cursor(None) m_custom_cursor(None)
{ {
// Set up the minimum atrributes that we require and see if /* Set up the minimum atrributes that we require and see if
// X can find us a visual matching those requirements. * X can find us a visual matching those requirements. */
int attributes[40], i, samples; int attributes[40], i, samples;
Atom atoms[2]; Atom atoms[2];
int natom; int natom;
int glxVersionMajor, glxVersionMinor; // As in GLX major.minor int glxVersionMajor, glxVersionMinor; /* As in GLX major.minor */
#ifdef WITH_X11_XINPUT #ifdef WITH_X11_XINPUT
/* initialize incase X11 fails to load */ /* initialize incase X11 fails to load */
@@ -251,11 +251,11 @@ GHOST_WindowX11(
} }
} }
// Create a bunch of attributes needed to create an X window. /* Create a bunch of attributes needed to create an X window. */
// First create a colormap for the window and visual. /* First create a colormap for the window and visual.
// This seems pretty much a legacy feature as we are in rgba mode anyway. * This seems pretty much a legacy feature as we are in rgba mode anyway. */
XSetWindowAttributes xattributes; XSetWindowAttributes xattributes;
memset(&xattributes, 0, sizeof(xattributes)); memset(&xattributes, 0, sizeof(xattributes));
@@ -268,7 +268,7 @@ GHOST_WindowX11(
xattributes.border_pixel = 0; xattributes.border_pixel = 0;
// Specify which events we are interested in hearing. /* Specify which events we are interested in hearing. */
xattributes.event_mask = xattributes.event_mask =
ExposureMask | StructureNotifyMask | ExposureMask | StructureNotifyMask |
@@ -277,7 +277,7 @@ GHOST_WindowX11(
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | FocusChangeMask | PropertyChangeMask; PointerMotionMask | FocusChangeMask | PropertyChangeMask;
// create the window! /* create the window! */
; ;
if (parentWindow == 0) { if (parentWindow == 0) {
@@ -287,7 +287,7 @@ GHOST_WindowX11(
top, top,
width, width,
height, height,
0, // no border. 0, /* no border. */
m_visual->depth, m_visual->depth,
InputOutput, InputOutput,
m_visual->visual, m_visual->visual,
@@ -311,12 +311,12 @@ GHOST_WindowX11(
m_window = XCreateWindow(m_display, m_window = XCreateWindow(m_display,
parentWindow, // reparent against embedder parentWindow, /* reparent against embedder */
left, left,
top, top,
width, width,
height, height,
0, // no border. 0, /* no border. */
m_visual->depth, m_visual->depth,
InputOutput, InputOutput,
m_visual->visual, m_visual->visual,
@@ -353,9 +353,9 @@ GHOST_WindowX11(
m_post_init = False; m_post_init = False;
m_post_state = GHOST_kWindowStateNormal; m_post_state = GHOST_kWindowStateNormal;
} }
// Create some hints for the window manager on how /* Create some hints for the window manager on how
// we want this window treated. * we want this window treated. */
XSizeHints *xsizehints = XAllocSizeHints(); XSizeHints *xsizehints = XAllocSizeHints();
xsizehints->flags = PPosition | PSize | PMinSize | PMaxSize; xsizehints->flags = PPosition | PSize | PMinSize | PMaxSize;
@@ -363,8 +363,8 @@ GHOST_WindowX11(
xsizehints->y = top; xsizehints->y = top;
xsizehints->width = width; xsizehints->width = width;
xsizehints->height = height; xsizehints->height = height;
xsizehints->min_width = 320; // size hints, could be made apart of the ghost api xsizehints->min_width = 320; /* size hints, could be made apart of the ghost api */
xsizehints->min_height = 240; // limits are also arbitrary, but should not allow 1x1 window xsizehints->min_height = 240; /* limits are also arbitrary, but should not allow 1x1 window */
xsizehints->max_width = 65535; xsizehints->max_width = 65535;
xsizehints->max_height = 65535; xsizehints->max_height = 65535;
XSetWMNormalHints(m_display, m_window, xsizehints); XSetWMNormalHints(m_display, m_window, xsizehints);
@@ -404,7 +404,7 @@ GHOST_WindowX11(
m_xic = NULL; m_xic = NULL;
#endif #endif
// Set the window icon /* Set the window icon */
XWMHints *xwmhints = XAllocWMHints(); XWMHints *xwmhints = XAllocWMHints();
XImage *x_image, *mask_image; XImage *x_image, *mask_image;
Pixmap icon_pixmap, mask_pixmap; Pixmap icon_pixmap, mask_pixmap;
@@ -442,7 +442,7 @@ GHOST_WindowX11(
XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT); XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT); XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
// Now the pixmap is ok to assign to the window as a hint /* Now the pixmap is ok to assign to the window as a hint */
xwmhints->icon_pixmap = icon_pixmap; xwmhints->icon_pixmap = icon_pixmap;
xwmhints->icon_mask = mask_pixmap; xwmhints->icon_mask = mask_pixmap;
XFreeGC(display, gc_icon); XFreeGC(display, gc_icon);
@@ -455,7 +455,7 @@ GHOST_WindowX11(
xwmhints->flags = InputHint | IconPixmapHint | IconMaskHint | StateHint; xwmhints->flags = InputHint | IconPixmapHint | IconMaskHint | StateHint;
XSetWMHints(display, m_window, xwmhints); XSetWMHints(display, m_window, xwmhints);
XFree(xwmhints); XFree(xwmhints);
// done setting the icon /* done setting the icon */
setTitle(title); setTitle(title);
@@ -463,7 +463,7 @@ GHOST_WindowX11(
initXInputDevices(); initXInputDevices();
#endif #endif
// now set up the rendering context. /* now set up the rendering context. */
if (installDrawingContext(type) == GHOST_kSuccess) { if (installDrawingContext(type) == GHOST_kSuccess) {
m_valid_setup = true; m_valid_setup = true;
GHOST_PRINT("Created window\n"); GHOST_PRINT("Created window\n");
@@ -748,8 +748,8 @@ setTitle(
(const unsigned char *) title.ReadPtr(), (const unsigned char *) title.ReadPtr(),
title.Length()); title.Length());
// This should convert to valid x11 string /* This should convert to valid x11 string
// and getTitle would need matching change * and getTitle would need matching change */
XStoreName(m_display, m_window, title); XStoreName(m_display, m_window, title);
XFlush(m_display); XFlush(m_display);
@@ -772,8 +772,8 @@ GHOST_WindowX11::
getWindowBounds( getWindowBounds(
GHOST_Rect& bounds) const GHOST_Rect& bounds) const
{ {
// Getting the window bounds under X11 is not /* Getting the window bounds under X11 is not
// really supported (nor should it be desired). * really supported (nor should it be desired). */
getClientBounds(bounds); getClientBounds(bounds);
} }
@@ -848,7 +848,7 @@ screenToClient(
GHOST_TInt32& outX, GHOST_TInt32& outX,
GHOST_TInt32& outY) const GHOST_TInt32& outY) const
{ {
// This is correct! /* This is correct! */
int ax, ay; int ax, ay;
Window temp; Window temp;
@@ -1274,18 +1274,18 @@ GHOST_TSuccess
GHOST_WindowX11:: GHOST_WindowX11::
invalidate() invalidate()
{ {
// So the idea of this function is to generate an expose event /* So the idea of this function is to generate an expose event
// for the window. * for the window.
// Unfortunately X does not handle expose events for you and * Unfortunately X does not handle expose events for you and
// it is the client's job to refresh the dirty part of the window. * it is the client's job to refresh the dirty part of the window.
// We need to queue up invalidate calls and generate GHOST events * We need to queue up invalidate calls and generate GHOST events
// for them in the system. * for them in the system.
*
// We implement this by setting a boolean in this class to concatenate * We implement this by setting a boolean in this class to concatenate
// all such calls into a single event for this window. * all such calls into a single event for this window.
*
// At the same time we queue the dirty windows in the system class * At the same time we queue the dirty windows in the system class
// and generate events for them at the next processEvents call. * and generate events for them at the next processEvents call. */
if (m_invalid_window == false) { if (m_invalid_window == false) {
m_system->addDirtyWindow(this); m_system->addDirtyWindow(this);
@@ -1384,7 +1384,7 @@ GHOST_WindowX11::
installDrawingContext( installDrawingContext(
GHOST_TDrawingContextType type) GHOST_TDrawingContextType type)
{ {
// only support openGL for now. /* only support openGL for now. */
GHOST_TSuccess success; GHOST_TSuccess success;
switch (type) { switch (type) {
case GHOST_kDrawingContextTypeOpenGL: case GHOST_kDrawingContextTypeOpenGL:

View File

@@ -414,8 +414,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
collpair->bp2 = face2->v2; collpair->bp2 = face2->v2;
collpair->bp3 = face2->v3; collpair->bp3 = face2->v3;
} }
else else {
i++; i++;
}
} }
if ( i == 2 ) { if ( i == 2 ) {
if ( face2->v4 ) { if ( face2->v4 ) {
@@ -429,8 +430,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
collpair->bp2 = face2->v4; collpair->bp2 = face2->v4;
collpair->bp3 = face2->v3; collpair->bp3 = face2->v3;
} }
else else {
break; break;
}
} }
else if ( i == 3 ) { else if ( i == 3 ) {
if ( face1->v4 && face2->v4 ) { if ( face1->v4 && face2->v4 ) {
@@ -444,8 +446,9 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
collpair->bp2 = face2->v3; collpair->bp2 = face2->v3;
collpair->bp3 = face2->v4; collpair->bp3 = face2->v4;
} }
else else {
break; break;
}
} }
#ifdef USE_BULLET #ifdef USE_BULLET
@@ -464,8 +467,7 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
collpair->flag = 0; collpair->flag = 0;
collpair++; collpair++;
}/* }/*
else else {
{
float w1, w2, w3, u1, u2, u3; float w1, w2, w3, u1, u2, u3;
float v1[3], v2[3], relativeVelocity[3]; float v1[3], v2[3], relativeVelocity[3];

View File

@@ -110,7 +110,7 @@ static BezTriple *mask_spline_point_prev_bezt(MaskSpline *spline, MaskSplinePoin
if (spline->flag & MASK_SPLINE_CYCLIC) { if (spline->flag & MASK_SPLINE_CYCLIC) {
return &(points_array[0].bezt); return &(points_array[0].bezt);
} }
else { else {
return NULL; return NULL;
} }
} }
@@ -2610,7 +2610,7 @@ void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, floa
} }
} }
if(do_mask_aa){ if (do_mask_aa) {
//PLX_antialias_buffer(buffer,width,height); //PLX_antialias_buffer(buffer,width,height);
} }
/* clamp at the end */ /* clamp at the end */
@@ -2620,7 +2620,8 @@ void BKE_mask_rasterize_layers(ListBase *masklayers, int width, int height, floa
} }
#ifdef __PLX_RASKTER_MT__ #ifdef __PLX_RASKTER_MT__
void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int width, int height, const short do_aspect_correct){ void BKE_mask_init_layers(Mask *mask, struct layer_init_data *mlayer_data, int width, int height, const short do_aspect_correct)
{
MaskLayer *masklay; MaskLayer *masklay;
int numLayers=0; int numLayers=0;
int currLayer=0; int currLayer=0;

View File

@@ -916,7 +916,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
} }
} }
if ( (animType->camera) != 0) { if (animType->camera != 0) {
Camera *camera = (Camera *) ob->data; Camera *camera = (Camera *) ob->data;
if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID *)&camera->id, 1); if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID *)&camera->id, 1);

View File

@@ -135,7 +135,7 @@ void GeometryExporter::operator()(Object *ob)
// XXX slow // XXX slow
if (ob->totcol) { if (ob->totcol) {
for (int a = 0; a < ob->totcol; a++) { for (int a = 0; a < ob->totcol; a++) {
createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind); createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind);
} }
} }

View File

@@ -122,11 +122,13 @@ public:
/** /**
* @brief after execution the state will be set to available by calling this method * @brief after execution the state will be set to available by calling this method
*/ */
void setCreatedState() { void setCreatedState()
{
this->m_state = COM_MB_AVAILABLE; this->m_state = COM_MB_AVAILABLE;
} }
inline void read(float result[4], int x, int y) { inline void read(float result[4], int x, int y)
{
if (x >= this->m_rect.xmin && x < this->m_rect.xmax && if (x >= this->m_rect.xmin && x < this->m_rect.xmax &&
y >= this->m_rect.ymin && y < this->m_rect.ymax) y >= this->m_rect.ymin && y < this->m_rect.ymax)
{ {
@@ -140,7 +142,8 @@ public:
} }
} }
inline void readNoCheck(float result[4], int x, int y) { inline void readNoCheck(float result[4], int x, int y)
{
const int dx = x - this->m_rect.xmin; const int dx = x - this->m_rect.xmin;
const int dy = y - this->m_rect.ymin; const int dy = y - this->m_rect.ymin;
const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS; const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS;
@@ -150,42 +153,42 @@ public:
void writePixel(int x, int y, const float color[4]); void writePixel(int x, int y, const float color[4]);
void addPixel(int x, int y, const float color[4]); void addPixel(int x, int y, const float color[4]);
inline void readCubic(float result[4], float x, float y) inline void readCubic(float result[4], float x, float y)
{ {
int x1 = floor(x); int x1 = floor(x);
int x2 = x1 + 1; int x2 = x1 + 1;
int y1 = floor(y); int y1 = floor(y);
int y2 = y1 + 1; int y2 = y1 + 1;
float valuex = x - x1; float valuex = x - x1;
float valuey = y - y1; float valuey = y - y1;
float mvaluex = 1.0f - valuex; float mvaluex = 1.0f - valuex;
float mvaluey = 1.0f - valuey; float mvaluey = 1.0f - valuey;
float color1[4]; float color1[4];
float color2[4]; float color2[4];
float color3[4]; float color3[4];
float color4[4]; float color4[4];
read(color1, x1, y1); read(color1, x1, y1);
read(color2, x1, y2); read(color2, x1, y2);
read(color3, x2, y1); read(color3, x2, y1);
read(color4, x2, y2); read(color4, x2, y2);
color1[0] = color1[0] * mvaluey + color2[0] * valuey; color1[0] = color1[0] * mvaluey + color2[0] * valuey;
color1[1] = color1[1] * mvaluey + color2[1] * valuey; color1[1] = color1[1] * mvaluey + color2[1] * valuey;
color1[2] = color1[2] * mvaluey + color2[2] * valuey; color1[2] = color1[2] * mvaluey + color2[2] * valuey;
color1[3] = color1[3] * mvaluey + color2[3] * valuey; color1[3] = color1[3] * mvaluey + color2[3] * valuey;
color3[0] = color3[0] * mvaluey + color4[0] * valuey; color3[0] = color3[0] * mvaluey + color4[0] * valuey;
color3[1] = color3[1] * mvaluey + color4[1] * valuey; color3[1] = color3[1] * mvaluey + color4[1] * valuey;
color3[2] = color3[2] * mvaluey + color4[2] * valuey; color3[2] = color3[2] * mvaluey + color4[2] * valuey;
color3[3] = color3[3] * mvaluey + color4[3] * valuey; color3[3] = color3[3] * mvaluey + color4[3] * valuey;
result[0] = color1[0] * mvaluex + color3[0] * valuex; result[0] = color1[0] * mvaluex + color3[0] * valuex;
result[1] = color1[1] * mvaluex + color3[1] * valuex; result[1] = color1[1] * mvaluex + color3[1] * valuex;
result[2] = color1[2] * mvaluex + color3[2] * valuex; result[2] = color1[2] * mvaluex + color3[2] * valuex;
result[3] = color1[3] * mvaluex + color3[3] * valuex; result[3] = color1[3] * mvaluex + color3[3] * valuex;
} }

View File

@@ -92,9 +92,9 @@ public:
*/ */
void execute(WorkPackage *work); void execute(WorkPackage *work);
cl_context getContext(){ return this->m_context; } cl_context getContext() { return this->m_context; }
cl_command_queue getQueue(){ return this->m_queue; } cl_command_queue getQueue() { return this->m_queue; }
cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader); cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader);
cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, ReadBufferOperation *reader); cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, ReadBufferOperation *reader);

View File

@@ -94,7 +94,7 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, void *data)
int bufferstartx = inputBuffer->getRect()->xmin; int bufferstartx = inputBuffer->getRect()->xmin;
int bufferstarty = inputBuffer->getRect()->ymin; int bufferstarty = inputBuffer->getRect()->ymin;
int pixelSize = this->m_size * this->getWidth() / 100.0f; int pixelSize = this->m_size * this->getWidth() / 100.0f;
if (pixelSize==0){ if (pixelSize==0) {
this->m_inputProgram->read(color, x, y, COM_PS_NEAREST); this->m_inputProgram->read(color, x, y, COM_PS_NEAREST);
return; return;
} }

View File

@@ -520,7 +520,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic)); PyObject *gameLogic_keys_new = PyDict_Keys(PyModule_GetDict(gameLogic));
const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new); const Py_ssize_t numitems= PyList_GET_SIZE(gameLogic_keys_new);
Py_ssize_t listIndex; Py_ssize_t listIndex;
for (listIndex=0; listIndex < numitems; listIndex++) { for (listIndex=0; listIndex < numitems; listIndex++) {
PyObject* item = PyList_GET_ITEM(gameLogic_keys_new, listIndex); PyObject* item = PyList_GET_ITEM(gameLogic_keys_new, listIndex);
if (!PySequence_Contains(gameLogic_keys, item)) { if (!PySequence_Contains(gameLogic_keys, item)) {
PyDict_DelItem( PyModule_GetDict(gameLogic), item); PyDict_DelItem( PyModule_GetDict(gameLogic), item);

View File

@@ -63,16 +63,16 @@ public:
m_lastDeformUpdate(-1) m_lastDeformUpdate(-1)
{}; {};
virtual ~BL_MeshDeformer(); virtual ~BL_MeshDeformer();
virtual void SetSimulatedTime(double time){} virtual void SetSimulatedTime(double time) {}
virtual bool Apply(class RAS_IPolyMaterial *mat); virtual bool Apply(class RAS_IPolyMaterial *mat);
virtual bool Update(void){ return false; } virtual bool Update(void) { return false; }
virtual bool UpdateBuckets(void){ return false; } virtual bool UpdateBuckets(void) { return false; }
virtual RAS_Deformer* GetReplica(){return NULL;} virtual RAS_Deformer* GetReplica() {return NULL;}
virtual void ProcessReplica(); virtual void ProcessReplica();
struct Mesh* GetMesh() { return m_bmesh; } struct Mesh* GetMesh() { return m_bmesh; }
virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; } virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; }
virtual float (* GetTransVerts(int *tot))[3] { *tot= m_tvtot; return m_transverts; } virtual float (* GetTransVerts(int *tot))[3] { *tot= m_tvtot; return m_transverts; }
// virtual void InitDeform(double time){} // virtual void InitDeform(double time) {}
protected: protected:
class RAS_MeshObject* m_pMeshObject; class RAS_MeshObject* m_pMeshObject;

View File

@@ -57,7 +57,7 @@ public:
void Remove(int i); void Remove(int i);
void Resize(int num); void Resize(int num);
void SetValue(int i,CValue* val); void SetValue(int i,CValue* val);
CValue* GetValue(int i){ assertd(i < m_pValueArray.size()); return m_pValueArray[i];} CValue* GetValue(int i) { assertd(i < m_pValueArray.size()); return m_pValueArray[i]; }
int GetCount() { return m_pValueArray.size(); } int GetCount() { return m_pValueArray.size(); }
virtual const STR_String & GetText(); virtual const STR_String & GetText();

View File

@@ -45,12 +45,19 @@ class CVoidValue : public CPropValue
public: public:
/// Construction/destruction /// Construction/destruction
CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { } CVoidValue() : m_bDeleteOnDestruct(false), m_pAnything(NULL) { }
CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) : m_bDeleteOnDestruct(bDeleteOnDestruct), m_pAnything(voidptr) { if (alloctype == STACKVALUE) CValue::DisableRefCount(); } CVoidValue(void * voidptr, bool bDeleteOnDestruct, AllocationTYPE alloctype) :
virtual ~CVoidValue(); // Destruct void value, delete memory if we're owning it m_bDeleteOnDestruct(bDeleteOnDestruct),
m_pAnything(voidptr)
{
if (alloctype == STACKVALUE) {
CValue::DisableRefCount();
}
}
virtual ~CVoidValue(); /* Destruct void value, delete memory if we're owning it */
/// Value -> String or number /// Value -> String or number
virtual const STR_String & GetText(); // Get string description of void value (unimplemented) virtual const STR_String & GetText(); /* Get string description of void value (unimplemented) */
virtual double GetNumber() { return -1; } virtual double GetNumber() { return -1; }
/// Value calculation /// Value calculation
@@ -70,5 +77,5 @@ public:
#endif #endif
}; };
#endif // !defined _VOIDVALUE_H #endif /* __VOIDVALUE_H__ */

View File

@@ -251,7 +251,7 @@ SCA_IActuator* SCA_IObject::FindActuator(const STR_String& actuatorname)
void SCA_IObject::Suspend() void SCA_IObject::Suspend()
{ {
if ((!m_ignore_activity_culling) if ((!m_ignore_activity_culling)
&& (!m_suspended)) { && (!m_suspended)) {
m_suspended = true; m_suspended = true;
/* flag suspend for all sensors */ /* flag suspend for all sensors */
SCA_SensorList::iterator i = m_sensors.begin(); SCA_SensorList::iterator i = m_sensors.begin();

View File

@@ -103,7 +103,7 @@ public:
void Resize(int width, int height); void Resize(int width, int height);
virtual void ResizeWindow(int width, int height){}; virtual void ResizeWindow(int width, int height) {}
/** /**
* \section Methods inherited from abstract base class RAS_ICanvas. * \section Methods inherited from abstract base class RAS_ICanvas.

View File

@@ -884,7 +884,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
Py_RETURN_NONE; Py_RETURN_NONE;
} }
if (!GLEW_ARB_shader_objects) { if (!GLEW_ARB_shader_objects) {
if (!mModified) if (!mModified)
spit("GLSL not supported"); spit("GLSL not supported");
mModified = true; mModified = true;

View File

@@ -1291,8 +1291,7 @@ void KX_GameObject::Resume(void)
void KX_GameObject::Suspend() void KX_GameObject::Suspend()
{ {
if ((!m_ignore_activity_culling) if ((!m_ignore_activity_culling) && (!m_suspended)) {
&& (!m_suspended)) {
SCA_IObject::Suspend(); SCA_IObject::Suspend();
if (GetPhysicsController()) if (GetPhysicsController())
GetPhysicsController()->SuspendDynamics(); GetPhysicsController()->SuspendDynamics();

View File

@@ -138,9 +138,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
#ifdef USE_MATHUTILS #ifdef USE_MATHUTILS
/* no need for BaseMath_ReadCallback() here, reading the sequences will do this */ /* no need for BaseMath_ReadCallback() here, reading the sequences will do this */
if(VectorObject_Check(pyval)) { if (VectorObject_Check(pyval)) {
VectorObject *pyvec= (VectorObject *)pyval; VectorObject *pyvec= (VectorObject *)pyval;
if(BaseMath_ReadCallback(pyvec) == -1) { if (BaseMath_ReadCallback(pyvec) == -1) {
return false; /* exception raised */ return false; /* exception raised */
} }
if (pyvec->size != Size(vec)) { if (pyvec->size != Size(vec)) {
@@ -150,9 +150,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
vec.setValue((float *) pyvec->vec); vec.setValue((float *) pyvec->vec);
return true; return true;
} }
else if(QuaternionObject_Check(pyval)) { else if (QuaternionObject_Check(pyval)) {
QuaternionObject *pyquat= (QuaternionObject *)pyval; QuaternionObject *pyquat= (QuaternionObject *)pyval;
if(BaseMath_ReadCallback(pyquat) == -1) { if (BaseMath_ReadCallback(pyquat) == -1) {
return false; /* exception raised */ return false; /* exception raised */
} }
if (4 != Size(vec)) { if (4 != Size(vec)) {
@@ -163,9 +163,9 @@ bool PyVecTo(PyObject* pyval, T& vec)
vec.setValue((float *) pyquat->quat); vec.setValue((float *) pyquat->quat);
return true; return true;
} }
else if(EulerObject_Check(pyval)) { else if (EulerObject_Check(pyval)) {
EulerObject *pyeul= (EulerObject *)pyval; EulerObject *pyeul= (EulerObject *)pyval;
if(BaseMath_ReadCallback(pyeul) == -1) { if (BaseMath_ReadCallback(pyeul) == -1) {
return false; /* exception raised */ return false; /* exception raised */
} }
if (3 != Size(vec)) { if (3 != Size(vec)) {
@@ -174,10 +174,10 @@ bool PyVecTo(PyObject* pyval, T& vec)
} }
vec.setValue((float *) pyeul->eul); vec.setValue((float *) pyeul->eul);
return true; return true;
} else }
else
#endif #endif
if(PyTuple_Check(pyval)) if (PyTuple_Check(pyval)) {
{
unsigned int numitems = PyTuple_GET_SIZE(pyval); unsigned int numitems = PyTuple_GET_SIZE(pyval);
if (numitems != Size(vec)) { if (numitems != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec)); PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec));
@@ -194,8 +194,8 @@ bool PyVecTo(PyObject* pyval, T& vec)
return true; return true;
} }
else if (PyObject_TypeCheck(pyval, (PyTypeObject *)&PyObjectPlus::Type)) else if (PyObject_TypeCheck(pyval, (PyTypeObject *)&PyObjectPlus::Type)) {
{ /* note, include this check because PySequence_Check does too much introspection /* note, include this check because PySequence_Check does too much introspection
* on the PyObject (like getting its __class__, on a BGE type this means searching up * on the PyObject (like getting its __class__, on a BGE type this means searching up
* the parent list each time only to discover its not a sequence. * the parent list each time only to discover its not a sequence.
* GameObjects are often used as an alternative to vectors so this is a common case * GameObjects are often used as an alternative to vectors so this is a common case
@@ -207,16 +207,14 @@ bool PyVecTo(PyObject* pyval, T& vec)
PyErr_Format(PyExc_AttributeError, "expected a sequence type"); PyErr_Format(PyExc_AttributeError, "expected a sequence type");
return false; return false;
} }
else if (PySequence_Check(pyval)) else if (PySequence_Check(pyval)) {
{
unsigned int numitems = PySequence_Size(pyval); unsigned int numitems = PySequence_Size(pyval);
if (numitems != Size(vec)) { if (numitems != Size(vec)) {
PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec)); PyErr_Format(PyExc_AttributeError, "error setting vector, %d args, should be %d", numitems, Size(vec));
return false; return false;
} }
for (unsigned int x = 0; x < numitems; x++) for (unsigned int x = 0; x < numitems; x++) {
{
PyObject *item = PySequence_GetItem(pyval, x); /* new ref */ PyObject *item = PySequence_GetItem(pyval, x); /* new ref */
vec[x] = PyFloat_AsDouble(item); vec[x] = PyFloat_AsDouble(item);
Py_DECREF(item); Py_DECREF(item);
@@ -228,8 +226,8 @@ bool PyVecTo(PyObject* pyval, T& vec)
} }
return true; return true;
} else }
{ else {
PyErr_Format(PyExc_AttributeError, "not a sequence type, expected a sequence of numbers size %d", Size(vec)); PyErr_Format(PyExc_AttributeError, "not a sequence type, expected a sequence of numbers size %d", Size(vec));
} }

View File

@@ -43,7 +43,7 @@ class MT_CmMatrix4x4;
class KX_WorldInfo class KX_WorldInfo
{ {
public: public:
KX_WorldInfo(){} KX_WorldInfo() {}
virtual ~KX_WorldInfo(); virtual ~KX_WorldInfo();
virtual bool hasWorld()=0; virtual bool hasWorld()=0;

View File

@@ -107,7 +107,7 @@ class PHY_IPhysicsEnvironment
/// Perform an integration step of duration 'timeStep'. /// Perform an integration step of duration 'timeStep'.
virtual bool proceedDeltaTime(double curTime,float timeStep,float interval)=0; virtual bool proceedDeltaTime(double curTime,float timeStep,float interval)=0;
///draw debug lines (make sure to call this during the render phase, otherwise lines are not drawn properly) ///draw debug lines (make sure to call this during the render phase, otherwise lines are not drawn properly)
virtual void debugDrawWorld(){} virtual void debugDrawWorld() {}
virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0; virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep)=0;
//returns 0.f if no fixed timestep is used //returns 0.f if no fixed timestep is used
virtual float getFixedTimeStep()=0; virtual float getFixedTimeStep()=0;
@@ -117,7 +117,7 @@ class PHY_IPhysicsEnvironment
///setNumIterations set the number of iterations for iterative solvers ///setNumIterations set the number of iterations for iterative solvers
virtual void setNumIterations(int numIter) {} virtual void setNumIterations(int numIter) {}
///setNumTimeSubSteps set the number of divisions of the timestep. Tradeoff quality versus performance. ///setNumTimeSubSteps set the number of divisions of the timestep. Tradeoff quality versus performance.
virtual void setNumTimeSubSteps(int numTimeSubSteps){} virtual void setNumTimeSubSteps(int numTimeSubSteps) {}
///setDeactivationTime sets the minimum time that an objects has to stay within the velocity tresholds until it gets fully deactivated ///setDeactivationTime sets the minimum time that an objects has to stay within the velocity tresholds until it gets fully deactivated
virtual void setDeactivationTime(float dTime) {} virtual void setDeactivationTime(float dTime) {}
///setDeactivationLinearTreshold sets the linear velocity treshold, see setDeactivationTime ///setDeactivationLinearTreshold sets the linear velocity treshold, see setDeactivationTime
@@ -150,7 +150,7 @@ class PHY_IPhysicsEnvironment
float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0 float axis2X=0,float axis2Y=0,float axis2Z=0,int flag=0
)=0; )=0;
virtual void removeConstraint(int constraintid)=0; virtual void removeConstraint(int constraintid)=0;
virtual float getAppliedImpulse(int constraintid){ return 0.f;} virtual float getAppliedImpulse(int constraintid) { return 0.0f; }
//complex constraint for vehicles //complex constraint for vehicles

View File

@@ -49,8 +49,8 @@ class RAS_MeshObject;
class RAS_Deformer class RAS_Deformer
{ {
public: public:
RAS_Deformer() : m_pMesh(NULL), m_bDynamic(false) {}; RAS_Deformer() : m_pMesh(NULL), m_bDynamic(false) {}
virtual ~RAS_Deformer(){}; virtual ~RAS_Deformer() {}
virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map)=0; virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map)=0;
virtual bool Apply(class RAS_IPolyMaterial *polymat)=0; virtual bool Apply(class RAS_IPolyMaterial *polymat)=0;
virtual bool Update(void)=0; virtual bool Update(void)=0;

View File

@@ -174,7 +174,7 @@ public:
virtual bool UsesObjectColor() const; virtual bool UsesObjectColor() const;
virtual bool CastsShadows() const; virtual bool CastsShadows() const;
virtual void Replace_IScene(SCA_IScene *val) {}; /* overridden by KX_BlenderMaterial */ virtual void Replace_IScene(SCA_IScene *val) {} /* overridden by KX_BlenderMaterial */
/** /**
* \return the equivalent drawing mode for the material settings (equivalent to old TexFace tface->mode). * \return the equivalent drawing mode for the material settings (equivalent to old TexFace tface->mode).
@@ -184,7 +184,7 @@ public:
/* /*
* PreCalculate texture gen * PreCalculate texture gen
*/ */
virtual void OnConstruction(int layer){} virtual void OnConstruction(int layer) {}
#ifdef WITH_CXX_GUARDEDALLOC #ifdef WITH_CXX_GUARDEDALLOC

View File

@@ -64,8 +64,8 @@ typedef vector< KX_IndexArray* > vecIndexArrays;
class RAS_IRasterizer class RAS_IRasterizer
{ {
public: public:
RAS_IRasterizer(RAS_ICanvas* canv){}; RAS_IRasterizer(RAS_ICanvas* canv) {};
virtual ~RAS_IRasterizer(){}; virtual ~RAS_IRasterizer() {};
/** /**
* Drawing types * Drawing types
@@ -401,8 +401,8 @@ public:
virtual const MT_Matrix4x4& GetViewMatrix() const = 0; virtual const MT_Matrix4x4& GetViewMatrix() const = 0;
virtual const MT_Matrix4x4& GetViewInvMatrix() const = 0; virtual const MT_Matrix4x4& GetViewInvMatrix() const = 0;
virtual bool QueryLists(){return false;} virtual bool QueryLists() { return false; }
virtual bool QueryArrays(){return false;} virtual bool QueryArrays() { return false; }
virtual void EnableMotionBlur(float motionblurvalue)=0; virtual void EnableMotionBlur(float motionblurvalue)=0;
virtual void DisableMotionBlur()=0; virtual void DisableMotionBlur()=0;

View File

@@ -54,7 +54,7 @@ class KX_ListSlot
protected: protected:
int m_refcount; int m_refcount;
public: public:
KX_ListSlot(){ m_refcount=1; } KX_ListSlot() { m_refcount = 1; }
virtual ~KX_ListSlot() {} virtual ~KX_ListSlot() {}
virtual int Release() { virtual int Release() {
if (--m_refcount > 0) if (--m_refcount > 0)

View File

@@ -106,7 +106,7 @@ public:
/* modification state */ /* modification state */
bool MeshModified(); bool MeshModified();
void SetMeshModified(bool v){m_bMeshModified = v;} void SetMeshModified(bool v) { m_bMeshModified = v; }
/* original blender mesh */ /* original blender mesh */
Mesh* GetMesh() { return m_mesh; } Mesh* GetMesh() { return m_mesh; }

View File

@@ -72,7 +72,7 @@ public:
virtual void SetDrawingMode(int drawingmode); virtual void SetDrawingMode(int drawingmode);
virtual bool QueryLists(){return true;} virtual bool QueryLists() {return true;}
#ifdef WITH_CXX_GUARDEDALLOC #ifdef WITH_CXX_GUARDEDALLOC

View File

@@ -533,10 +533,10 @@ void RAS_OpenGLRasterizer::SetEye(const StereoEye eye)
glDrawBuffer(m_curreye == RAS_STEREO_LEFTEYE ? GL_BACK_LEFT : GL_BACK_RIGHT); glDrawBuffer(m_curreye == RAS_STEREO_LEFTEYE ? GL_BACK_LEFT : GL_BACK_RIGHT);
break; break;
case RAS_STEREO_ANAGLYPH: case RAS_STEREO_ANAGLYPH:
if (m_curreye == RAS_STEREO_LEFTEYE) if (m_curreye == RAS_STEREO_LEFTEYE) {
{
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE); glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_FALSE);
} else { }
else {
//glAccum(GL_LOAD, 1.0); //glAccum(GL_LOAD, 1.0);
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE);
ClearDepthBuffer(); ClearDepthBuffer();
@@ -892,7 +892,8 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
int current_blend_mode = GPU_get_material_alpha_blend(); int current_blend_mode = GPU_get_material_alpha_blend();
ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM); ms.m_pDerivedMesh->drawFacesGLSL(ms.m_pDerivedMesh, CheckMaterialDM);
GPU_set_material_alpha_blend(current_blend_mode); GPU_set_material_alpha_blend(current_blend_mode);
} else { }
else {
//ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol); //ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
current_blmat_nr = current_polymat->GetMaterialIndex(); current_blmat_nr = current_polymat->GetMaterialIndex();
current_image = current_polymat->GetBlenderImage(); current_image = current_polymat->GetBlenderImage();

View File

@@ -302,9 +302,9 @@ public:
virtual int GetMotionBlurState() { return m_motionblur; } virtual int GetMotionBlurState() { return m_motionblur; }
virtual void SetMotionBlurState(int newstate) virtual void SetMotionBlurState(int newstate)
{ {
if(newstate<0) if (newstate < 0)
m_motionblur = 0; m_motionblur = 0;
else if(newstate>2) else if (newstate > 2)
m_motionblur = 2; m_motionblur = 2;
else else
m_motionblur = newstate; m_motionblur = newstate;

View File

@@ -58,8 +58,8 @@ public:
private: private:
virtual void EnableTextures(bool enable); virtual void EnableTextures(bool enable);
//virtual bool QueryArrays(){return true;} //virtual bool QueryArrays() {return true;}
//virtual bool QueryLists(){return m_Lock;} //virtual bool QueryLists() {return m_Lock;}
#ifdef WITH_CXX_GUARDEDALLOC #ifdef WITH_CXX_GUARDEDALLOC

View File

@@ -217,7 +217,8 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const
right.m_min[2] = m_min[2]; right.m_min[2] = m_min[2];
right.m_max = m_max; right.m_max = m_max;
std::cout << "splity" << std::endl; std::cout << "splity" << std::endl;
} else { }
else {
left.m_min = m_min; left.m_min = m_min;
left.m_max[0] = m_max[0]; left.m_max[0] = m_max[0];
left.m_max[1] = m_max[1]; left.m_max[1] = m_max[1];
@@ -229,9 +230,9 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const
right.m_max = m_max; right.m_max = m_max;
std::cout << "splitz" << std::endl; std::cout << "splitz" << std::endl;
} }
} else { }
if (sizex > sizez) else {
{ if (sizex > sizez) {
left.m_min = m_min; left.m_min = m_min;
left.m_max[0] = m_min[0] + sizex/2.0; left.m_max[0] = m_min[0] + sizex/2.0;
left.m_max[1] = m_max[1]; left.m_max[1] = m_max[1];
@@ -242,7 +243,8 @@ void SG_BBox::split(SG_BBox &left, SG_BBox &right) const
right.m_min[2] = m_min[2]; right.m_min[2] = m_min[2];
right.m_max = m_max; right.m_max = m_max;
std::cout << "splitx" << std::endl; std::cout << "splitx" << std::endl;
} else { }
else {
left.m_min = m_min; left.m_min = m_min;
left.m_max[0] = m_max[0]; left.m_max[0] = m_max[0];
left.m_max[1] = m_max[1]; left.m_max[1] = m_max[1];

View File

@@ -151,10 +151,12 @@ RelativeTranslate(
) { ) {
if (local) { if (local) {
m_localPosition += m_localRotation * trans; m_localPosition += m_localRotation * trans;
} else { }
else {
if (parent) { if (parent) {
m_localPosition += trans * parent->GetWorldOrientation(); m_localPosition += trans * parent->GetWorldOrientation();
} else { }
else {
m_localPosition += trans; m_localPosition += trans;
} }
} }

View File

@@ -296,7 +296,8 @@ SG_Tree* SG_TreeFactory::MakeTreeDown(SG_BBox &bbox)
{ {
lefttree.Add(*it); lefttree.Add(*it);
hasleft++; hasleft++;
} else { }
else {
righttree.Add(*it); righttree.Add(*it);
hasright++; hasright++;
} }

View File

@@ -246,7 +246,8 @@ bool ImageBase::checkSourceSizes (void)
// set current size as reference // set current size as reference
refSize = curSize; refSize = curSize;
// otherwise check with current size // otherwise check with current size
} else if (curSize[0] != refSize[0] || curSize[1] != refSize[1]) { }
else if (curSize[0] != refSize[0] || curSize[1] != refSize[1]) {
// if they don't match, report it // if they don't match, report it
return false; return false;
} }

View File

@@ -208,11 +208,11 @@ void ImageRender::Render()
frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar); frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
m_camera->SetProjectionMatrix(projmat); m_camera->SetProjectionMatrix(projmat);
} else if (m_camera->hasValidProjectionMatrix()) }
{ else if (m_camera->hasValidProjectionMatrix()) {
m_rasterizer->SetProjectionMatrix(m_camera->GetProjectionMatrix()); m_rasterizer->SetProjectionMatrix(m_camera->GetProjectionMatrix());
} else }
{ else {
float lens = m_camera->GetLens(); float lens = m_camera->GetLens();
float sensor_x = m_camera->GetSensorWidth(); float sensor_x = m_camera->GetSensorWidth();
float sensor_y = m_camera->GetSensorHeight(); float sensor_y = m_camera->GetSensorHeight();
@@ -241,8 +241,8 @@ void ImageRender::Render()
projmat = m_rasterizer->GetOrthoMatrix( projmat = m_rasterizer->GetOrthoMatrix(
frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar); frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
} else }
{ else {
RAS_FramingManager::ComputeDefaultFrustum( RAS_FramingManager::ComputeDefaultFrustum(
nearfrust, nearfrust,
farfrust, farfrust,
@@ -604,13 +604,12 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
mirrorVerts.push_back(v1); mirrorVerts.push_back(v1);
mirrorVerts.push_back(v2); mirrorVerts.push_back(v2);
mirrorVerts.push_back(v3); mirrorVerts.push_back(v3);
if (polygon->VertexCount() == 4) if (polygon->VertexCount() == 4) {
{
v4 = polygon->GetVertex(3); v4 = polygon->GetVertex(3);
mirrorVerts.push_back(v4); mirrorVerts.push_back(v4);
area = normal_quad_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ()); area = normal_quad_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ());
} else }
{ else {
area = normal_tri_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ()); area = normal_tri_v3(normal,(float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ());
} }
area = fabs(area); area = fabs(area);

View File

@@ -130,13 +130,12 @@ short getMaterialID(PyObject * obj, const char *name)
if (mat == NULL) if (mat == NULL)
break; break;
// name is a material name if it starts with MA and a UV texture name if it starts with IM // name is a material name if it starts with MA and a UV texture name if it starts with IM
if (name[0] == 'I' && name[1] == 'M') if (name[0] == 'I' && name[1] == 'M') {
{
// if texture name matches // if texture name matches
if (strcmp(mat->GetTextureName().ReadPtr(), name) == 0) if (strcmp(mat->GetTextureName().ReadPtr(), name) == 0)
return matID; return matID;
} else }
{ else {
// if material name matches // if material name matches
if (strcmp(mat->GetMaterialName().ReadPtr(), name) == 0) if (strcmp(mat->GetMaterialName().ReadPtr(), name) == 0)
return matID; return matID;