MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / main

Function main

Samples/2.0/Tutorials/Tutorial00_Basic/Tutorial00_Basic.cpp:147–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR strCmdLine, INT nCmdShow )
146#else
147int main( int argc, const char *argv[] )
148#endif
149{
150 using namespace Ogre;
151
152#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
153 const String pluginsFolder = macResourcesPath();
154 const String writeAccessFolder = macLogPath();
155#else
156 const String pluginsFolder = "./";
157 const String writeAccessFolder = pluginsFolder;
158#endif
159
160#ifndef OGRE_STATIC_LIB
161# if OGRE_DEBUG_MODE && \
162 !( ( OGRE_PLATFORM == OGRE_PLATFORM_APPLE ) || ( OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS ) )
163 const char *pluginsFile = "plugins_d.cfg";
164# else
165 const char *pluginsFile = "plugins.cfg";
166# endif
167#else
168 const char *pluginsFile = 0; // TODO
169#endif
170
171 const Ogre::AbiCookie abiCookie = Ogre::generateAbiCookie();
172 Root *root = OGRE_NEW Root( &abiCookie, pluginsFolder + pluginsFile, //
173 writeAccessFolder + "ogre.cfg", //
174 writeAccessFolder + "Ogre.log" );
175
176 if( !root->showConfigDialog() )
177 return -1;
178
179 // Initialize Root
180 root->getRenderSystem()->setConfigOption( "sRGB Gamma Conversion", "Yes" );
181 Window *window = root->initialise( true, "Tutorial 00: Basic" );
182
183 registerHlms();
184
185 // Create SceneManager
186 const size_t numThreads = 1u;
187 SceneManager *sceneManager = root->createSceneManager( ST_GENERIC, numThreads, "ExampleSMInstance" );
188
189 // Create & setup camera
190 Camera *camera = sceneManager->createCamera( "Main Camera" );
191
192 // Position it at 500 in Z direction
193 camera->setPosition( Vector3( 0, 5, 15 ) );
194 // Look back along -Z
195 camera->lookAt( Vector3( 0, 0, 0 ) );
196 camera->setNearClipDistance( 0.2f );
197 camera->setFarClipDistance( 1000.0f );
198 camera->setAutoAspectRatio( true );
199
200 // Setup a basic compositor with a blue clear colour
201 CompositorManager2 *compositorManager = root->getCompositorManager2();
202 const String workspaceName( "Demo Workspace" );
203 const ColourValue backgroundColour( 0.2f, 0.4f, 0.6f );
204 compositorManager->createBasicWorkspaceDef( workspaceName, backgroundColour, IdString() );

Callers

nothing calls this directly

Calls 15

generateAbiCookieFunction · 0.85
showConfigDialogMethod · 0.80
setNearClipDistanceMethod · 0.80
setFarClipDistanceMethod · 0.80
setAutoAspectRatioMethod · 0.80
addWorkspaceMethod · 0.80
registerHlmsFunction · 0.70
RootClass · 0.50
Vector3Function · 0.50
IdStringClass · 0.50
setConfigOptionMethod · 0.45

Tested by

no test coverage detected