Permalink
Browse files

Adjusted namespaces in Graphics module.

  • Loading branch information...
1 parent 2a4ad04 commit 8b22479c7dbc98bb9443c6fc3480cf68b15675c3 @gamaral committed Aug 10, 2012
View
@@ -42,7 +42,8 @@
#include <cmath>
MARSHMALLOW_NAMESPACE_BEGIN
-namespace { /******************************************** Anonymous Namespace */
+namespace Graphics { /************************************ Graphics Namespace */
+namespace { /******************************** Graphics::<anonymous> Namespace */
struct CameraData
{
@@ -67,9 +68,7 @@ UpdateVisibility(void)
s_data.visibility = l_size / s_data.transform.scale();
}
-} /****************************************************** Anonymous Namespace */
-
-namespace Graphics { /************************************ Graphics Namespace */
+} /****************************************** Graphics::<anonymous> Namespace */
void
Camera::Reset(void)
@@ -44,12 +44,15 @@
#include "graphics/imesh.h"
MARSHMALLOW_NAMESPACE_BEGIN
-namespace { /******************************************** Anonymous Namespace */
- Math::Matrix4 s_matrix_current;
- Graphics::Color s_bgcolor;
-} /****************************************************** Anonymous Namespace */
-
namespace Graphics { /************************************ Graphics Namespace */
+namespace Dummy { /******************************** Graphics::Dummy Namespace */
+namespace { /************************* Graphics::Dummy::<anonymous> Namespace */
+
+Math::Matrix4 s_matrix_current;
+Color s_bgcolor;
+
+} /*********************************** Graphics::Dummy::<anonymous> Namespace */
+} /************************************************ Graphics::Dummy Namespace */
void
Painter::Initialize(void)
@@ -74,24 +77,28 @@ Painter::Reset(void)
const Color &
Painter::BackgroundColor(void)
{
+ using namespace Dummy;
return(s_bgcolor);
}
void
Painter::SetBackgroundColor(const Color &color)
{
+ using namespace Dummy;
s_bgcolor = color;
}
Math::Matrix4 &
Painter::Matrix(void)
{
+ using namespace Dummy;
return(s_matrix_current);
}
void
Painter::LoadIdentity(void)
{
+ using namespace Dummy;
s_matrix_current = Math::Matrix4::Identity();
}
@@ -42,28 +42,34 @@
#include "graphics/painter_p.h"
MARSHMALLOW_NAMESPACE_BEGIN
-namespace { /******************************************** Anonymous Namespace */
- Graphics::Display dpy;
- bool active;
-} /****************************************************** Anonymous Namespace */
-
namespace Graphics { /************************************ Graphics Namespace */
+namespace Dummy { /******************************** Graphics::Dummy Namespace */
+namespace { /************************* Graphics::Dummy::<anonymous> Namespace */
+
+Graphics::Display s_dpy;
+bool s_active;
+
+} /*********************************** Graphics::Dummy::<anonymous> Namespace */
+} /************************************************ Graphics::Dummy Namespace */
bool
Viewport::Active(void)
{
- return(active);
+ using namespace Dummy;
+ return(s_active);
}
bool
Viewport::Initialize(void)
{
+ using namespace Dummy;
+
/* default display display */
- dpy.depth = MARSHMALLOW_VIEWPORT_DEPTH;
- dpy.fullscreen = MARSHMALLOW_VIEWPORT_FULLSCREEN;
- dpy.height = MARSHMALLOW_VIEWPORT_HEIGHT;
- dpy.vsync = MARSHMALLOW_VIEWPORT_VSYNC;
- dpy.width = MARSHMALLOW_VIEWPORT_WIDTH;
+ s_dpy.depth = MARSHMALLOW_VIEWPORT_DEPTH;
+ s_dpy.fullscreen = MARSHMALLOW_VIEWPORT_FULLSCREEN;
+ s_dpy.height = MARSHMALLOW_VIEWPORT_HEIGHT;
+ s_dpy.vsync = MARSHMALLOW_VIEWPORT_VSYNC;
+ s_dpy.width = MARSHMALLOW_VIEWPORT_WIDTH;
/*
* Initial Camera Reset (IMPORTANT)
@@ -75,7 +81,7 @@ Viewport::Initialize(void)
*/
Painter::SetBackgroundColor(Color::Black());
- active = false;
+ s_active = false;
return(true);
}
@@ -89,23 +95,25 @@ Viewport::Finalize(void)
bool
Viewport::Setup(const Graphics::Display &display)
{
+ using namespace Dummy;
+
MMDEBUG("Dummy viewport setup.");
- if (active) {
+ if (s_active) {
Painter::Finalize();
- active = false;
+ s_active = false;
}
- dpy = display;
+ s_dpy = display;
Camera::Update();
Painter::Initialize();
#if MARSHMALLOW_DUMMY_FAIL
- return(active = false);
+ return(s_active = false);
#else
- return(active = true);
+ return(s_active = true);
#endif
}
@@ -122,12 +130,15 @@ Viewport::SwapBuffer(void)
const Graphics::Display &
Viewport::Display(void)
{
- return(dpy);
+ using namespace Dummy;
+ return(s_dpy);
}
const Math::Size2f &
Viewport::Size(void)
{
+ using namespace Dummy;
+
const static Math::Size2f s_size(MARSHMALLOW_VIEWPORT_WIDTH,
MARSHMALLOW_VIEWPORT_HEIGHT);
return(s_size);
@@ -136,8 +147,10 @@ Viewport::Size(void)
const Math::Size2i &
Viewport::WindowSize(void)
{
+ using namespace Dummy;
+
static Math::Size2i s_size;
- s_size.set(dpy.width, dpy.height);
+ s_size.set(s_dpy.width, s_dpy.height);
return(s_size);
}
@@ -44,7 +44,8 @@
#include <tinyxml2.h>
MARSHMALLOW_NAMESPACE_BEGIN
-namespace { /******************************************** Anonymous Namespace */
+namespace Graphics { /************************************ Graphics Namespace */
+namespace { /******************************** Graphics::<anonymous> Namespace */
static const char * s_scalemode_string[Graphics::ITextureData::smModes] =
{ "nearest", "linear" };
@@ -69,9 +70,7 @@ ScaleModeToString(Graphics::ITextureData::ScaleMode mode)
return(s_scalemode_string[mode]);
}
-} /****************************************************** Anonymous Namespace */
-
-namespace Graphics { /************************************ Graphics Namespace */
+} /****************************************** Graphics::<anonymous> Namespace */
struct MeshBase::Private
{
@@ -40,7 +40,9 @@
#include <cassert>
MARSHMALLOW_NAMESPACE_BEGIN
-namespace { /******************************************** Anonymous Namespace */
+namespace Graphics { /************************************ Graphics Namespace */
+namespace OpenGL { /****************************** Graphics::OpenGL Namespace */
+namespace { /************************ Graphics::OpenGL::<anonymous> Namespace */
std::set<std::string> s_supported_extensions;
@@ -70,10 +72,7 @@ ParseExtensionsString(const char *e)
}
}
-} /****************************************************** Anonymous Namespace */
-
-namespace Graphics { /************************************ Graphics Namespace */
-namespace OpenGL { /****************************** Graphics::OpenGL Namespace */
+} /********************************** Graphics::OpenGL::<anonymous> Namespace */
#ifndef MMGL_VERSION_2_0
/* required */
@@ -65,15 +65,14 @@
MARSHMALLOW_NAMESPACE_BEGIN
namespace Graphics { /************************************ Graphics Namespace */
+namespace OpenGL { /****************************** Graphics::OpenGL Namespace */
/*!
* Must be implemented by viewport.
*/
typedef void (*PFNPROC)(void);
PFNPROC glGetProcAddress(const char *func);
-namespace OpenGL { /****************************** Graphics::OpenGL Namespace */
-
/*
* Required, no checks needed.
*/
@@ -46,19 +46,22 @@ namespace Graphics { /************************************ Graphics Namespace */
SharedTextureCoordinateData
Factory::CreateTextureCoordinateData(uint16_t c)
{
- return(new OpenGL::TextureCoordinateData(c));
+ using namespace OpenGL;
+ return(new TextureCoordinateData(c));
}
SharedTextureData
Factory::CreateTextureData(void)
{
- return(new OpenGL::TextureData());
+ using namespace OpenGL;
+ return(new TextureData());
}
SharedVertexData
Factory::CreateVertexData(uint16_t c)
{
- return(new OpenGL::VertexData(c));
+ using namespace OpenGL;
+ return(new VertexData(c));
}
} /******************************************************* Graphics Namespace */
Oops, something went wrong.

0 comments on commit 8b22479

Please sign in to comment.