game design and dev ogre3d overview

18
Game Design and Dev Ogre3D Overview CSE 786 Prof. Roger Crawfis

Upload: fathia

Post on 23-Feb-2016

60 views

Category:

Documents


0 download

DESCRIPTION

Game Design and Dev Ogre3D Overview. CSE 786 Prof. Roger Crawfis. Ogre 3D. Base web site: www.ogre3d.org Download and install Notes The SDK just seems to unpack the files where they were, so move to you development area (Programming/SDKs?) The Environment variable (OGRE_HOME) was not set. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Game Design and Dev Ogre3D Overview

Game Design and DevOgre3D Overview

CSE 786Prof. Roger Crawfis

Page 2: Game Design and Dev Ogre3D Overview

Ogre 3D

Base web site: www.ogre3d.org Download and install Notes

The SDK just seems to unpack the files where they were, so move to you development area (Programming/SDKs?)

The Environment variable (OGRE_HOME) was not set. Use this in you Project settings.

Includes Boost and OIS. Does not include CEGUI. OIS name conflicts with Ogre (Vector3), so never have a:

using namespace OIS; Wiki

Tutorials API documentation …

Page 3: Game Design and Dev Ogre3D Overview

What is Ogre3D?

Object-OrientedA little old school and the code is getting

bloated.Not very well engineered now.

Some Design Patterns usedSingletonsManagersFactory Methods

Page 4: Game Design and Dev Ogre3D Overview

What is Ogre3D?

Plug-In Architecture Rendering System Core Features Enhancements

Dynamically loads dll’s at runtime. Copy the ones you need over to your repository. Default framework reads in a config file to

determine which plug-ins to load. Not automatic.

Page 5: Game Design and Dev Ogre3D Overview

Plug-In Framework

Default Plugins.cfg# Defines plugins to load

# Define plugin folderPluginFolder=.

# Define pluginsPlugin=RenderSystem_Direct3D9_dPlugin=RenderSystem_GL_dPlugin=Plugin_ParticleFX_dPlugin=Plugin_BSPSceneManager_dPlugin=Plugin_CgProgramManager_dPlugin=Plugin_PCZSceneManager_d.dllPlugin=Plugin_OctreeZone_d.dllPlugin=Plugin_OctreeSceneManager_d

Page 6: Game Design and Dev Ogre3D Overview

Media Resources

Default Resources.cfg file:# Resource locations to be added to the 'boostrap' path# This also contains the minimum you need to use the Ogre example framework[Bootstrap]Zip=../../media/packs/OgreCore.zip

# Resource locations to be added to the default path[General]FileSystem=../../mediaFileSystem=../../media/fontsFileSystem=../../media/materials/programsFileSystem=../../media/materials/scriptsFileSystem=../../media/materials/texturesFileSystem=../../media/modelsFileSystem=../../media/overlaysFileSystem=../../media/particleFileSystem=../../media/guiFileSystem=../../media/DeferredShadingMediaFileSystem=../../media/PCZAppMediaZip=../../media/packs/cubemap.zipZip=../../media/packs/cubemapsJS.zipZip=../../media/packs/dragon.zipZip=../../media/packs/fresneldemo.zipZip=../../media/packs/ogretestmap.zipZip=../../media/packs/skybox.zip

Page 7: Game Design and Dev Ogre3D Overview
Page 8: Game Design and Dev Ogre3D Overview

Core Objects

Page 9: Game Design and Dev Ogre3D Overview

Startup Sequence

ExampleApplication Go() Setup() Configure() setupResources() chooseSceneManager() createCamera() createViewport() createResourceListener() loadResources() createScene() frameStarted/Ended() createFrameListener() destroyScene()

Page 10: Game Design and Dev Ogre3D Overview

Basic Scene

Entity, SceneNodeCamera, lights, shadowsBSP mapIntegrated ODE physicsBSP mapFrame listeners

Page 11: Game Design and Dev Ogre3D Overview

Terrain, sky, fog

Page 12: Game Design and Dev Ogre3D Overview

CEGUI

Window, panel, scrollbar, listbox, button, static text

Media/gui/ogregui.layoutCEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().loadWind

owLayout( (CEGUI::utf8*)"ogregui.layout"); mGUISystem->setGUISheet(sheet);

Page 13: Game Design and Dev Ogre3D Overview

Animation

Node animation (camera, light sources)Skeletal Animation

AnimationState *mAnimationState; mAnimationState = ent-

>getAnimationState("Idle");mAnimationState->setLoop(true);mAnimationState->setEnabled(true); mAnimationState-

>addTime(evt.timeSinceLastFrame); mNode->rotate(quat);

Page 14: Game Design and Dev Ogre3D Overview

Animation

Crowd (instancing vs single entity)InstancedGeometry* batch = new InstancedGeometry(mCamera->getSceneManager(),

"robots" );batch->addEntity(ent, Vector3::ZERO);batch->build();Facial animationVertexPoseKeyFrame* manualKeyFrame;manualKeyFrame->addPoseReference();manualKeyFrame->updatePoseReference ( ushort

 poseIndex, Real influence) 

Page 15: Game Design and Dev Ogre3D Overview

Picking

CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition(); Ray mouseRay = mCamera->getCameraToViewportRay(mousePos.d_x/float(arg.state.width), mousePos.d_y/float(arg.state.height)); mRaySceneQuery->setRay(mouseRay); mRaySceneQuery->setSortByDistance(false); RaySceneQueryResult &result = mRaySceneQuery->execute(); RaySceneQueryResult::iterator mouseRayItr; Vector3 nodePos; for (mouseRayItr = result.begin(); mouseRayItr != result.end(); mouseRayItr++) { if (mouseRayItr->worldFragment) { nodePos = mouseRayItr->worldFragment->singleIntersection; break; } // if }

Page 16: Game Design and Dev Ogre3D Overview

Particle Effects

Examples/sil{ material Examples/Flare2 particle_width 75 particle_height 100 cull_each false quota 1000 billboard_type oriented_self // Area emitter emitter Point { angle 30 emission_rate 75 time_to_live 2 direction 0 1 0 velocity_min 250 velocity_max 300 colour_range_start 0 0 0 colour_range_end 1 1 1 } // Gravity affector LinearForce { force_vector 0 -100 0 force_application add } // Fader affector ColourFader { red -0.5 green -0.5 blue -0.5 }}

mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject( mSceneMgr->createParticleSystem("sil", "Examples/sil"));

Page 17: Game Design and Dev Ogre3D Overview

Particle EffectsParticle system attributesquota material particle_width particle_height cull_each billboard_type billboard_origin billboard_rotation_type common_direction common_up_vector renderer sorted local_space point_rendering accurate_facing iteration_interval nonvisible_update_timeout

Emitter attributes(point, box, clyinder, ellipsoid, hollow ellipsoid, ring)angle colour colour_range_start colour_range_end direction emission_rate position velocity velocity_min velocity_max time_to_live time_to_live_min time_to_live_max duration duration_min duration_max repeat_delay repeat_delay_min repeat_delay_max

Affectors (LinearForce, ColorFader)Linear Force Affector ColourFader Affector ColourFader2 Affector Scaler Affector Rotator Affector ColourInterpolator Affector ColourImage Affector DeflectorPlane Affector DirectionRandomiser Affector

Page 18: Game Design and Dev Ogre3D Overview

Fire and Smoke

affector Rotator { rotation_range_start 0 rotation_range_end 360 rotation_speed_range_start -60 rotation_speed_range_end 200 }