[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25775] trunk/blender: OpenGL Anti-aliasing implementation for blender windows

Damien Plisson damien.plisson at yahoo.fr
Wed Jan 6 12:42:52 CET 2010


Revision: 25775
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25775
Author:   damien78
Date:     2010-01-06 12:42:52 +0100 (Wed, 06 Jan 2010)

Log Message:
-----------
OpenGL Anti-aliasing implementation for blender windows

Added GHOST_TUns16 numOfAASamples parameter to GHOST_CreateWindow to specify the number of AA samples (null if no AA wanted)
Implemented it in the cascade of GHOST classes.

Full implementation currently done for OSX/Cocoa, stubs for other OSes.
Moguri : it's ready for your win32 implementation !

Note that fallback to a non AA window (if gfx card doesn't support AA) is done inside GHOST OS specific layer, so that blender windowmanager still gets its window created properly. 

Modified Paths:
--------------
    trunk/blender/intern/ghost/GHOST_C-api.h
    trunk/blender/intern/ghost/GHOST_ISystem.h
    trunk/blender/intern/ghost/intern/GHOST_C-api.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
    trunk/blender/intern/ghost/intern/GHOST_Window.cpp
    trunk/blender/intern/ghost/intern/GHOST_Window.h
    trunk/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp
    trunk/blender/intern/ghost/intern/GHOST_WindowCarbon.h
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.h
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
    trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_WindowWin32.h
    trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_WindowX11.h
    trunk/blender/source/blender/windowmanager/intern/wm_window.c

Modified: trunk/blender/intern/ghost/GHOST_C-api.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_C-api.h	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/GHOST_C-api.h	2010-01-06 11:42:52 UTC (rev 25775)
@@ -162,6 +162,8 @@
  * @param	height	The height the window.
  * @param	state	The state of the window when opened.
  * @param	type	The type of drawing context installed in this window.
+ * @param stereoVisual		Stereo visual for quad buffered stereo.
+ * @param numOfAASamples	Number of samples used for AA (zero if no AA)
  * @return	A handle to the new window ( == NULL if creation failed).
  */
 extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
@@ -172,7 +174,8 @@
 	GHOST_TUns32 height,
 	GHOST_TWindowState state,
 	GHOST_TDrawingContextType type,
-	const int stereoVisual);
+	const int stereoVisual,
+	const GHOST_TUns16 numOfAASamples);
 
 /**
  * Returns the window user data.

Modified: trunk/blender/intern/ghost/GHOST_ISystem.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_ISystem.h	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/GHOST_ISystem.h	2010-01-06 11:42:52 UTC (rev 25775)
@@ -216,14 +216,15 @@
 	 * Create a new window.
 	 * The new window is added to the list of windows managed. 
 	 * Never explicitly delete the window, use disposeWindow() instead.
-	 * @param	title	The name of the window (displayed in the title bar of the window if the OS supports it).
-	 * @param	left		The coordinate of the left edge of the window.
-	 * @param	top		The coordinate of the top edge of the window.
-	 * @param	width		The width the window.
-	 * @param	height		The height the window.
-	 * @param	state		The state of the window when opened.
-	 * @param	type		The type of drawing context installed in this window.
+	 * @param	title			The name of the window (displayed in the title bar of the window if the OS supports it).
+	 * @param	left			The coordinate of the left edge of the window.
+	 * @param	top				The coordinate of the top edge of the window.
+	 * @param	width			The width the window.
+	 * @param	height			The height the window.
+	 * @param	state			The state of the window when opened.
+	 * @param	type			The type of drawing context installed in this window.
 	 * @param	stereoVisual	Create a stereo visual for quad buffered stereo.
+	 * @param	numOfAASamples	Number of samples used for AA (zero if no AA)
 	 * @param	parentWindow 	Parent (embedder) window
 	 * @return	The new window (or 0 if creation failed).
 	 */
@@ -231,7 +232,8 @@
 		const STR_String& title,
 		GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
 		GHOST_TWindowState state, GHOST_TDrawingContextType type,
-		const bool stereoVisual,
+		const bool stereoVisual = false,
+		const GHOST_TUns16 numOfAASamples = 0,
 		const GHOST_TEmbedderWindowID parentWindow = 0) = 0;
 
 	/**

Modified: trunk/blender/intern/ghost/intern/GHOST_C-api.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_C-api.cpp	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/intern/GHOST_C-api.cpp	2010-01-06 11:42:52 UTC (rev 25775)
@@ -140,7 +140,8 @@
 									  GHOST_TUns32 height,
 									  GHOST_TWindowState state,
 									  GHOST_TDrawingContextType type,
-									  const int stereoVisual)
+									  const int stereoVisual,
+									  const GHOST_TUns16 numOfAASamples)
 {
 	GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
 	bool bstereoVisual;
@@ -151,7 +152,7 @@
 		bstereoVisual = false;
 
 	return (GHOST_WindowHandle) system->createWindow(title, left, top, width, height,
-		state, type, bstereoVisual);
+		state, type, bstereoVisual, numOfAASamples);
 }
 
 GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2010-01-06 11:42:52 UTC (rev 25775)
@@ -402,6 +402,7 @@
 	GHOST_TWindowState state,
 	GHOST_TDrawingContextType type,
 	bool stereoVisual,
+	const GHOST_TUns16 numOfAASamples,
 	const GHOST_TEmbedderWindowID parentWindow
 )
 {

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h	2010-01-06 11:42:52 UTC (rev 25775)
@@ -115,6 +115,7 @@
 		GHOST_TWindowState state,
 		GHOST_TDrawingContextType type,
 		const bool stereoVisual,
+		const GHOST_TUns16 numOfAASamples = 0,
 		const GHOST_TEmbedderWindowID parentWindow = 0 
 	);
 	

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h	2010-01-06 11:42:52 UTC (rev 25775)
@@ -93,13 +93,15 @@
 	 * Create a new window.
 	 * The new window is added to the list of windows managed. 
 	 * Never explicitly delete the window, use disposeWindow() instead.
-	 * @param	title	The name of the window (displayed in the title bar of the window if the OS supports it).
-	 * @param	left	The coordinate of the left edge of the window.
-	 * @param	top		The coordinate of the top edge of the window.
-	 * @param	width	The width the window.
-	 * @param	height	The height the window.
-	 * @param	state	The state of the window when opened.
-	 * @param	type	The type of drawing context installed in this window.
+	 * @param	title			The name of the window (displayed in the title bar of the window if the OS supports it).
+	 * @param	left			The coordinate of the left edge of the window.
+	 * @param	top				The coordinate of the top edge of the window.
+	 * @param	width			The width the window.
+	 * @param	height			The height the window.
+	 * @param	state			The state of the window when opened.
+	 * @param	type			The type of drawing context installed in this window.
+	 * @param	stereoVisual	Stereo visual for quad buffered stereo.
+	 * @param	numOfAASamples	Number of samples used for AA (zero if no AA)
 	 * @param	parentWindow 	Parent (embedder) window
 	 * @return	The new window (or 0 if creation failed).
 	 */
@@ -111,7 +113,8 @@
 		GHOST_TUns32 height,
 		GHOST_TWindowState state,
 		GHOST_TDrawingContextType type,
-		const bool stereoVisual,
+		const bool stereoVisual = false,
+		const GHOST_TUns16 numOfAASamples = 0,
 		const GHOST_TEmbedderWindowID parentWindow = 0 
 	);
 	

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2010-01-06 11:42:52 UTC (rev 25775)
@@ -657,6 +657,7 @@
 	GHOST_TWindowState state,
 	GHOST_TDrawingContextType type,
 	bool stereoVisual,
+	const GHOST_TUns16 numOfAASamples,
 	const GHOST_TEmbedderWindowID parentWindow
 )
 {
@@ -672,7 +673,7 @@
 	left = left > contentRect.origin.x ? left : contentRect.origin.x;
 	top = top > contentRect.origin.y ? top : contentRect.origin.y;
 	
-	window = new GHOST_WindowCocoa (this, title, left, top, width, height, state, type);
+	window = new GHOST_WindowCocoa (this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples);
 
     if (window) {
         if (window->getValid()) {

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2010-01-06 11:42:52 UTC (rev 25775)
@@ -190,7 +190,7 @@
 	const STR_String& title, 
 	GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
 	GHOST_TWindowState state, GHOST_TDrawingContextType type,
-	bool stereoVisual, const GHOST_TEmbedderWindowID parentWindow )
+	bool stereoVisual, const GHOST_TUns16 numOfAASamples, const GHOST_TEmbedderWindowID parentWindow )
 {
 	GHOST_Window* window = 0;
 	window = new GHOST_WindowWin32 (this, title, left, top, width, height, state, type, stereoVisual);

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h	2010-01-06 11:42:52 UTC (rev 25775)
@@ -110,6 +110,8 @@
 	 * @param	height	The height the window.
 	 * @param	state	The state of the window when opened.
 	 * @param	type	The type of drawing context installed in this window.
+	 * @param	stereoVisual	Stereo visual for quad buffered stereo.
+	 * @param	numOfAASamples	Number of samples used for AA (zero if no AA)
 	 * @param	parentWindow 	Parent (embedder) window
 	 * @return	The new window (or 0 if creation failed).
 	 */
@@ -117,7 +119,9 @@
 		const STR_String& title,
 		GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
 		GHOST_TWindowState state, GHOST_TDrawingContextType type,
-		const bool stereoVisual, const GHOST_TEmbedderWindowID parentWindow = 0 );
+		const bool stereoVisual = false,
+		const GHOST_TUns16 numOfAASamples = 0,
+		const GHOST_TEmbedderWindowID parentWindow = 0 );
 
 	/***************************************************************************************
 	 ** Event management functionality

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2010-01-06 11:38:58 UTC (rev 25774)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp	2010-01-06 11:42:52 UTC (rev 25775)
@@ -228,6 +228,8 @@
 	 * @param	height	The height the window.
 	 * @param	state	The state of the window when opened.
 	 * @param	type	The type of drawing context installed in this window.

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list