本文整理汇总了C++中SceneContext类的典型用法代码示例。如果您正苦于以下问题:C++ SceneContext类的具体用法?C++ SceneContext怎么用?C++ SceneContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SceneContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void
CaptureRectangle::draw(SceneContext& sc)
{
if (pingu && pingu->catchable())
{
// Draw the capture rectangle
if (session && pingu->change_allowed(session->get_action_name()))
{
sc.color().draw(good, pingu->get_center_pos() + Vector3f(0, 0, 1000));
}
else
{
sc.color().draw(bad, pingu->get_center_pos() + Vector3f(0, 0, 1000));
}
// Paint the direction arrow
if (pingu->direction.is_left())
{
sc.color().draw(arrow_left, pingu->get_center_pos() + Vector3f(0, 2, 1000));
}
else
{
sc.color().draw(arrow_right, pingu->get_center_pos() + Vector3f(0, 2, 1000));
}
sc.color().print_center(font,
Vector2i(static_cast<int>(pingu->get_center_pos().x),
static_cast<int>(pingu->get_center_pos().y - 46)),
action_str,
1000);
}
}
开发者ID:jcs12311,项目名称:pingus,代码行数:32,代码来源:capture_rectangle.cpp
示例2: switch
void
SnowParticleHolder::draw (SceneContext& gc)
{
for (std::vector<SnowParticle>::iterator it=particles.begin(); it != particles.end(); ++it)
{
if (!it->alive)
continue;
switch (it->type)
{
case Snow1:
gc.color().draw(snow1, it->pos);
break;
case Snow2:
gc.color().draw(snow2, it->pos);
break;
case Snow3:
gc.color().draw(snow3, it->pos);
break;
case Snow4:
gc.color().draw(snow4, it->pos);
break;
case Snow5:
gc.color().draw(snow5, it->pos);
break;
default:
assert(!"Invalid Snow-Type");
}
}
}
开发者ID:AMDmi3,项目名称:pingus,代码行数:30,代码来源:snow_particle_holder.cpp
示例3:
void
WoodThing::draw (SceneContext& gc)
{
gc.color().draw(surface2, pos);
// Only draw the animation if a pingu is coming out.
if (last_release > 0)
gc.color().draw(surface, pos);
}
开发者ID:jinguoliang,项目名称:Maemo-pingus,代码行数:8,代码来源:woodthing.cpp
示例4:
void
Walker::draw (SceneContext& gc)
{
gc.color().draw(walker[pingu->direction], pingu->get_pos());
if (pingu->get_fall_action() && pingu->get_fall_action()->get_type() == ActionName::FLOATER)
{
gc.color().draw(floaterlayer[pingu->direction], pingu->get_pos());
}
}
开发者ID:jcs12311,项目名称:pingus,代码行数:10,代码来源:walker.cpp
示例5: GetSceneContext
/**
* @brief
* Loads/reloads the sound
*/
void SNClipVolumeTexture::Load()
{
// Get/create a new volume resource instance (if there was a previous one, it will be destroyed by the manager as soon as no longer referenced)
bool bNewCreated = false;
Volume *pVolume = VolumeManager::GetInstance()->GetByName(m_sVolumeFilename);
if (!pVolume) {
pVolume = VolumeManager::GetInstance()->Create(m_sVolumeFilename);
bNewCreated = true;
}
// Give our volume resource handler the new resource (it's possible that the previous volume resource is now going to be destroyed)
m_pVolumeHandler->SetResource(pVolume);
// [TODO] Handle varying loader parameters
if (pVolume && bNewCreated) {
// Setup volume
if (pVolume) {
// Load in the volume data
if (pVolume->LoadByFilename(m_sVolumeFilename, LoaderParameters.Get())) {
// [TODO] Check this situation when the loader parameters do not match
// Try again without parameters?
if (!pVolume->GetVolumeImage().GetBuffer())
pVolume->LoadByFilename(m_sVolumeFilename);
// Create the texture buffer instance by using our image data
SceneContext *pSceneContext = GetSceneContext();
if (pSceneContext) {
// Get the renderer and renderer capabilities instance
Renderer &cRenderer = pSceneContext->GetRendererContext().GetRenderer();
// [TODO] Just a test (volume image to texture buffer)
TextureBuffer *pTextureBuffer = pVolume->GetVolumeTextureBuffer(cRenderer, !(GetFlags() & NoTextureCompression), !(GetFlags() & NoTextureMipmapping));
}
}
}
}
// Set the scale of the scene node?
if (pVolume && !(GetFlags() & NoVolumeScale)) {
// [TODO] Don't use the image data for this, may e.g. been unloaded within "GetVolumeTextureBuffer()"
ImageBuffer *pImageBuffer = pVolume->GetVolumeImage().GetBuffer();
if (pImageBuffer) {
// Get the size of one voxel (without metric, but usually one unit is equal to one meter)
const Vector3 &vVoxelSize = pVolume->GetVoxelSize();
// Get the image size aka the number of voxels along each diagonal
const Vector3i &vImageSize = pImageBuffer->GetSize();
// Set the scale of the scene node
SetScale(Vector3(vVoxelSize.x*vImageSize.x, vVoxelSize.y*vImageSize.y, vVoxelSize.z*vImageSize.z));
}
}
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:57,代码来源:SNClipVolumeTexture.cpp
示例6: typeid
void
WorldObj::draw (SceneContext& gc)
{
// FIXME: I need some docu on the meaning of get_x_offset() and co.
std::cout << "WorldObj:draw(SceneContext): Using compat-wrapper: "
<< typeid(*this).name () << std::endl;
#if 0 // FIXME:
draw_offset (static_cast<int>(gc.get_x_offset () + gc.get_width ()/2),
static_cast<int>(gc.get_y_offset () + gc.get_height ()/2),
gc.get_zoom ());
#endif
}
开发者ID:jinguoliang,项目名称:Maemo-pingus,代码行数:12,代码来源:worldobj.cpp
示例7: rect
void
TileMap::draw (SceneContext& sc)
{
Rect clip_rect = Rect(View::current()->get_clip_rect());
Rect rect(std::max(0, clip_rect.left/TILE_SIZE),
std::max(0, clip_rect.top/TILE_SIZE),
std::min(field.get_width(), clip_rect.right/TILE_SIZE + 1),
std::min(field.get_height(), clip_rect.bottom/TILE_SIZE + 1));
std::vector<VertexArrayDrawingRequest*> requests;
for (int y = rect.top; y < rect.bottom; ++y)
for (int x = rect.left; x < rect.right; ++x)
{
Tile* tile = field(x, y);
if (!(tile == 0 || tile->packer < 0))
{
int packer = tile->packer;
if(packer >= int(requests.size()))
requests.resize(packer+1);
VertexArrayDrawingRequest*& request = requests[packer];
if (!request)
{
request = new VertexArrayDrawingRequest(Vector(0, 0), z_pos,
sc.color().get_modelview());
request->set_mode(GL_QUADS);
request->set_blend_func(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
request->set_texture(tile->texture);
}
request->texcoord(tile->uv.left, tile->uv.top);
request->vertex(x * TILE_SIZE, y * TILE_SIZE);
request->texcoord(tile->uv.right, tile->uv.top);
request->vertex(x * TILE_SIZE + TILE_SIZE, y * TILE_SIZE);
request->texcoord(tile->uv.right, tile->uv.bottom);
request->vertex(x * TILE_SIZE + TILE_SIZE, y * TILE_SIZE + TILE_SIZE);
request->texcoord(tile->uv.left, tile->uv.bottom);
request->vertex(x * TILE_SIZE, y * TILE_SIZE + TILE_SIZE);
}
}
for(std::vector<VertexArrayDrawingRequest*>::iterator i = requests.begin(); i != requests.end(); ++i)
{
if (*i)
sc.color().draw(*i);
}
}
开发者ID:BackupTheBerlios,项目名称:windstille-svn,代码行数:53,代码来源:tile_map.cpp
示例8: GetSceneContext
//[-------------------------------------------------------]
//[ Protected virtual PLScene::SceneApplication functions ]
//[-------------------------------------------------------]
void EngineApplication::OnCreateRootScene()
{
// Get the scene context
SceneContext *pSceneContext = GetSceneContext();
if (pSceneContext) {
// First, create the scene root container which holds the scene container with our 'concrete' scene within it
SceneContainer *pRootContainer = pSceneContext->GetRoot() ? static_cast<SceneContainer*>(pSceneContext->GetRoot()->Create("PLScene::SceneContainer", "RootScene")) : nullptr;
if (pRootContainer) {
// Protect this important container!
pRootContainer->SetProtected(true);
// Create a scene container with our 'concrete scene'
SceneNode *pSceneContainerNode = pRootContainer->Create("PLScene::SceneContainer", "Scene");
if (pSceneContainerNode && pSceneContainerNode->IsInstanceOf("PLScene::SceneContainer")) {
SceneContainer *pSceneContainer = static_cast<SceneContainer*>(pSceneContainerNode);
// Protect this important container!
pSceneContainer->SetProtected(true);
// Connect event handler
if (pSceneContainerNode->IsInstanceOf("PLScene::SceneContainer"))
static_cast<SceneContainer*>(pSceneContainerNode)->SignalLoadProgress.Connect(EventHandlerLoadProgress);
// Create the 'concrete scene'
OnCreateScene(*pSceneContainer);
}
// Create scene node for engine information
SceneNode *pSceneNode = pRootContainer->Create("PLEngine::SNEngineInformation");
if (pSceneNode)
pSceneNode->SetActive(m_bEditModeEnabled);
// Create console scene node - using the console command 'timescale <value>' we
// can change the scene time (slowdown or accelerate)
pSceneNode = pRootContainer->Create("PLEngine::SNConsole");
if (pSceneNode && pSceneNode->GetClass()->IsDerivedFrom("PLEngine::SNConsoleBase")) {
SNConsoleBase *pConsole = static_cast<SNConsoleBase*>(pSceneNode);
// Register default commands
pConsole->RegisterCommand(0, "quit", "", "", Functor<void, ConsoleCommand &>(&EngineApplication::ConsoleCommandQuit, this));
pConsole->RegisterCommand(0, "exit", "", "", Functor<void, ConsoleCommand &>(&EngineApplication::ConsoleCommandQuit, this));
pConsole->RegisterCommand(0, "bye", "", "", Functor<void, ConsoleCommand &>(&EngineApplication::ConsoleCommandQuit, this));
pConsole->RegisterCommand(0, "logout", "", "", Functor<void, ConsoleCommand &>(&EngineApplication::ConsoleCommandQuit, this));
// Set active state
pConsole->SetActive(m_bEditModeEnabled);
}
}
// Set the root scene
SetRootScene(pRootContainer);
}
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:56,代码来源:EngineApplication.cpp
示例9:
void
Guillotine::draw (SceneContext& gc)
{
if (killing) {
if (direction.is_left())
gc.color().draw (sprite_kill_left, pos);
else
gc.color().draw (sprite_kill_right, pos);
} else {
gc.color().draw (sprite_idle, pos);
}
}
开发者ID:fsantanna,项目名称:pingus,代码行数:12,代码来源:guillotine.cpp
示例10:
void
ConveyorBelt::draw (SceneContext& gc)
{
gc.color().draw(left_sur, pos);
for (int i=0; i < width; ++i)
gc.color().draw(middle_sur,
Vector3f(static_cast<float>(pos.x + static_cast<float>(left_sur.get_width() + i * middle_sur.get_width())),
static_cast<float>(pos.y)));
gc.color().draw(right_sur,
Vector3f(static_cast<float>(pos.x + static_cast<float>(left_sur.get_width() + width * middle_sur.get_width())),
static_cast<float>(pos.y)));
}
开发者ID:fsantanna,项目名称:pingus,代码行数:13,代码来源:conveyor_belt.cpp
示例11: GetCullQuery
/**
* @brief
* Returns the visibility manager
*/
VisManager *VisContainer::GetVisManager() const
{
// Get the cull query
const SQCull *pSQCull = GetCullQuery();
if (pSQCull) {
// Get the scene context
SceneContext *pSceneContext = pSQCull->GetSceneContext();
if (pSceneContext)
return &pSceneContext->GetVisManager();
}
// Error!
return nullptr;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:18,代码来源:VisContainer.cpp
示例12:
void
SmokeParticleHolder::draw (SceneContext& gc)
{
for (std::vector<SmokeParticle>::iterator it=particles.begin(); it != particles.end(); ++it)
{
if (!it->livetime)
continue;
if (!it->use_surf2)
gc.color().draw(surf1, it->pos);
else
gc.color().draw(surf2, it->pos);
}
}
开发者ID:jcs12311,项目名称:pingus,代码行数:14,代码来源:smoke_particle_holder.cpp
示例13: GetPainter
//[-------------------------------------------------------]
//[ Private virtual PLEngine::EngineApplication functions ]
//[-------------------------------------------------------]
void Application67::OnCreateScene(SceneContainer &cContainer)
{
// Create a scene container with our 'concrete sound scene' using the default sound API
SceneNode *pSceneContainerNode = cContainer.Create("PLSound::SCSound", "SoundScene");
if (pSceneContainerNode && pSceneContainerNode->IsInstanceOf("PLScene::SceneContainer")) {
SceneContainer *pSceneContainer = static_cast<SceneContainer*>(pSceneContainerNode);
// Protect this important container!
pSceneContainer->SetProtected(true);
// Populate the scene container
// Setup scene surface painter
SurfacePainter *pPainter = GetPainter();
if (pPainter && pPainter->IsInstanceOf("PLScene::SPScene")) {
SPScene *pSPScene = static_cast<SPScene*>(pPainter);
pSPScene->SetRootContainer(cContainer.GetContainer());
pSPScene->SetSceneContainer(pSceneContainer);
// Get the scene context
SceneContext *pSceneContext = GetSceneContext();
if (pSceneContext) {
// Create us a scene renderer
SceneRenderer *pSceneRenderer = pSceneContext->GetSceneRendererManager().Create("2DGame");
if (pSceneRenderer) {
// Add begin scene renderer pass
pSceneRenderer->Create("PLCompositing::SRPBegin", "Begin", "TextureFormat=\"R8G8B8A8\" Flags=\"Inactive\"");
// Add our own scene renderer pass
pSceneRenderer->Create("SRP2DGame", "2DGame");
// Add post processing scene renderer pass
pSceneRenderer->Create("PLCompositing::SRPPostProcessing", "PostProcessing");
// Add end scene renderer pass
pSceneRenderer->Create("PLCompositing::SRPEnd", "End");
// Make this scene renderer to the default scene renderer of our scene surface painter
pSPScene->SetDefaultSceneRenderer(pSceneRenderer->GetName());
}
}
}
// Set scene container
SetScene(pSceneContainer);
// Start the game
Restart();
}
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:52,代码来源:Application67.cpp
示例14:
void
SurfaceBackground::draw (SceneContext& gc)
{
if (!bg_surface)
return;
if (fast_mode)
{
Display::clear();
}
else
{
if (render_preview)
{
#if 0 // FIXME:
for(int y = 0; y < gc.get_height(); y += bg_surface.get_height())
for(int x = 0; x < gc.get_width(); x += bg_surface.get_width())
gc.color().draw(bg_surface, Vector3f(x, y));
#endif
}
else
{
Vector3f offset = gc.color().world_to_screen(Vector3f(0,0));
int start_x = static_cast<int>((offset.x * para_x) + scroll_ox);
int start_y = static_cast<int>((offset.y * para_y) + scroll_oy);
if (start_x > 0)
start_x = (start_x % bg_surface.get_width()) - bg_surface.get_width();
if (start_y > 0)
start_y = (start_y % bg_surface.get_height()) - bg_surface.get_height();
for(int y = start_y;
y < world->get_height();
y += bg_surface.get_height())
{
for(int x = start_x;
x < world->get_width();
x += bg_surface.get_width())
{
gc.color().draw(bg_surface, Vector3f(x - offset.x,
y - offset.y, pos.z));
}
}
}
}
}
开发者ID:jinguoliang,项目名称:Maemo-pingus,代码行数:48,代码来源:surface_background.cpp
示例15: GetSceneContext
/**
* @brief
* Returns the used scene renderer
*/
SceneRenderer *SNCamera::GetSceneRenderer() const
{
// Get/load the scene renderer
SceneRenderer *pSceneRenderer = m_pSceneRendererHandler->GetResource();
if (!pSceneRenderer && m_sSceneRendererFilename.GetLength()) {
// Get the scene context
SceneContext *pSceneContext = GetSceneContext();
if (pSceneContext) {
pSceneRenderer = pSceneContext->GetSceneRendererManager().LoadResource(m_sSceneRendererFilename);
m_pSceneRendererHandler->SetResource(pSceneRenderer);
}
}
// Return the scene renderer
return pSceneRenderer;
}
开发者ID:ByeDream,项目名称:pixellight,代码行数:20,代码来源:SNCamera.cpp
示例16:
void
Spike::draw (SceneContext& gc)
{
if (killing) {
gc.color().draw (surface, pos);
} else {
// do nothing
}
}
开发者ID:AMDmi3,项目名称:pingus,代码行数:9,代码来源:spike.cpp
示例17:
void
IceBlock::draw (SceneContext& gc)
{
if (is_finished)
return;
gc.color().draw(block_sur,
pos);
//, static_cast<int>((1.0 - thickness) * (block_sur.get_frame_count() - 1)));
}
开发者ID:fsantanna,项目名称:pingus,代码行数:10,代码来源:ice_block.cpp
示例18: Parse
void XmlSceneParser::Parse (const ParseNode& decl, Node& parent, SceneContext& context)
{
try
{
for (Parser::Iterator iter=decl.First (); iter; ++iter)
{
try
{
ParseNode decl = *iter;
const char* type = decl.Name ();
Impl::ParserMap::iterator iter = impl->parsers.find (type);
if (iter == impl->parsers.end () || !iter->second.parse_handler)
continue; //игнорирование неизвестных узлов
iter->second.parse_handler (decl, parent, context);
}
catch (std::exception& e)
{
if (!context.FilterError (e.what ()))
throw;
print_log (context.LogHandler (), e.what ());
}
catch (...)
{
static const char* ERROR_STRING = "unknown exception";
if (!context.FilterError (ERROR_STRING))
throw;
print_log (context.LogHandler (), ERROR_STRING);
}
}
}
catch (xtl::exception& e)
{
e.touch ("scene_graph::XmlSceneParser::ParseDispatch");
throw;
}
}
开发者ID:untgames,项目名称:funner,代码行数:43,代码来源:sg_xml_scene_parser.cpp
示例19:
void
Liquid::draw (SceneContext& gc)
{
for(int x = static_cast<int>(pos.x);
x < pos.x + width;
x += sur.get_width())
{
gc.color().draw(sur, Vector3f((float)x, pos.y));
}
}
开发者ID:jinguoliang,项目名称:Maemo-pingus,代码行数:10,代码来源:liquid.cpp
示例20: render
void DeferredDirectionalLightsPass::render(IViewer* viewer, World& world, const SceneContext& sceneContext, unsigned int lightMapFrameBuffer, const DeferredInitRenderStage& initStage) {
GraphicsInterface::beginPerformanceEvent("Directional");
{
GraphicsInterface::beginPerformanceEvent("Lighting");
GraphicsInterface::setFrameBuffer(directionalLightFrameBuffer_);
std::vector<DirectionalLight> directionalLights = sceneContext.directionalLights();
for (std::vector<DirectionalLight>::iterator light = directionalLights.begin(); light != directionalLights.end(); ++light) {
directionalLightEffect_->beginDraw();
directionalLightEffect_->setTexture(GraphicsInterface::depthBufferTexture(), "DepthMap");
directionalLightEffect_->setTexture(initStage.normalMap(), "NormalMap");
directionalLightEffect_->setUniform(viewer->viewTransform(), "View");
Matrix4x4 viewProjection = viewer->projection() * viewer->viewTransform();
directionalLightEffect_->setUniform(viewProjection, "ViewProj");
directionalLightEffect_->setUniform(viewProjection.inverse(), "ViewProjInv");
directionalLightEffect_->setUniform(viewer->position(), "ViewPosition");
directionalLightEffect_->setUniform((*light).direction(), "LightDirection");
directionalLightEffect_->setUniform((*light).color(), "LightColor");
directionalLightEffect_->setUniform(GraphicsInterface::halfBackBufferPixel(), "HalfPixel");
//Matrix4x4 normalMatrix = viewer->viewTransform().mat3x3().inverseTranspose();
directionalLightEffect_->setUniform(Matrix4x4::IDENTITY.mat3x3(), "NormalMatrix");
directionalLightEffect_->commitBuffers();
GraphicsInterface::drawVertexBuffer(quadVbo_, Geometry::SCREEN_PLANE_VERTEX_COUNT, Geometry::SCREEN_PLANE_VERTEX_FORMAT);
directionalLightEffect_->endDraw();
}
GraphicsInterface::endPerformanceEvent();
}
{
GraphicsInterface::beginPerformanceEvent("Accumulation");
GraphicsInterface::setFrameBuffer(lightMapFrameBuffer);
GraphicsInterface::setBlendState(IGraphicsInterface::ADDITIVE);
accumulationEffect_->beginDraw();
accumulationEffect_->setTexture(directionalLightRenderTexture_, "LightSourceMap");
accumulationEffect_->setTexture(initStage.colorMap(), "ColorMap");
accumulationEffect_->commitBuffers();
GraphicsInterface::drawVertexBuffer(quadVbo_, Geometry::SCREEN_PLANE_VERTEX_COUNT, Geometry::SCREEN_PLANE_VERTEX_FORMAT);
accumulationEffect_->endDraw();
GraphicsInterface::setBlendState(IGraphicsInterface::NOBLEND);
GraphicsInterface::endPerformanceEvent();
}
GraphicsInterface::endPerformanceEvent();
}
开发者ID:gwowen,项目名称:indigo,代码行数:55,代码来源:DeferredDirectionalLightsPass.cpp
注:本文中的SceneContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论