Beispiel #1
0
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);
  }
}
Beispiel #2
0
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");
    }
  }
}
Beispiel #3
0
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);
}
Beispiel #4
0
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());
  }
}
/**
*  @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));
		}
	}
}
Beispiel #6
0
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
}
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);
    }
}
//[-------------------------------------------------------]
//[ 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);
	}
}
Beispiel #9
0
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);
  }
}
Beispiel #10
0
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)));
}
Beispiel #11
0
/**
*  @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;
}
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);
  }
}
Beispiel #13
0
//[-------------------------------------------------------]
//[ 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();
	}
}
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));
                }
            }
        }
    }
}
Beispiel #15
0
/**
*  @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;
}
Beispiel #16
0
void
Spike::draw (SceneContext& gc)
{
  if (killing) {
    gc.color().draw (surface, pos);
  } else {
    // do nothing
  }
}
Beispiel #17
0
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)));
}
Beispiel #18
0
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;
  }  
}
Beispiel #19
0
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));
    }
}
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();
}
void
Hedgehog::draw(SceneContext& gc)
{
  Sprite* s;

  if (state == DYING)
    s = &die_sprite;
  else
    s = &sprite;

  if (direction_left)
    s->set_vflip(true);
  else
    s->set_vflip(false);

  gc.color().draw(*s, pos, 2);
  //s->draw(int(pos.x), int(pos.y));
  gc.light().draw(light, pos, 0);
  gc.highlight().draw(highlight, pos, 0);
}
Beispiel #22
0
/**
*  @brief
*    Returns the default scene renderer
*/
SceneRenderer *SPScene::GetDefaultSceneRenderer() const
{
	// Get/load the scene renderer
	SceneRenderer *pSceneRenderer = m_pDefaultSceneRendererHandler->GetResource();
	if (!pSceneRenderer && m_sDefaultSceneRenderer.GetLength()) {
		// Get the root scene container
		SceneContainer *pRootContainer = GetRootContainer();
		if (pRootContainer) {
			// Get the scene context
			SceneContext *pSceneContext = pRootContainer->GetSceneContext();
			if (pSceneContext) {
				pSceneRenderer = pSceneContext->GetSceneRendererManager().LoadResource(m_sDefaultSceneRenderer);
				m_pDefaultSceneRendererHandler->SetResource(pSceneRenderer);
			}
		}
	}

	// Return the scene renderer
	return pSceneRenderer;
}
void
Sector::draw(SceneContext& sc)
{
  sc.light().fill_screen(ambient_light);

  for(Objects::iterator i = objects.begin(); i != objects.end(); ++i)
    {
      if ((*i)->is_active())
        (*i)->draw(sc);
    }
}
void
PinguParticleHolder::draw (SceneContext& gc)
{
  for (std::vector<PinguParticle>::iterator it=particles.begin(); it != particles.end(); ++it)
    {
      // skip dead particles
      if (!it->livetime)
        continue;

      gc.color().draw(surface, it->pos);
    }
}
void
Bomb::draw(SceneContext& sc)
{
  if (state == EXPLODE)
  {
    sc.color().draw(explo, pos);
    sc.light().draw(explolight, pos, 0);

    explolight.set_alpha(0.5);
    explolight.set_scale(0.5);

    sc.highlight().draw(explolight, pos, 0);

    explolight.set_alpha(1.0);
    explolight.set_scale(1.0);
  }
  else
  {
    sc.color().draw(sprite, pos);
    if (sprite.is_finished()) {
      sc.light().draw(light, pos, 0);
      sc.highlight().draw(highlight, pos, 0);
    }
  }
}
Beispiel #26
0
void
RainGenerator::draw (SceneContext& gc)
{
  if (do_thunder)
  {
    if (thunder_count < 0.0f) {
      do_thunder = false;
      thunder_count = 0.0f;
      waiter_count = 1.0f;
    }

    gc.color().fill_screen(Color(255, 255, 255, static_cast<uint8_t>(thunder_count*255)));
  }
}
void DeferredSpotLightsPass::render(IViewer* viewer, World& world, const SceneContext& sceneContext, unsigned int lightMapFrameBuffer, const DeferredInitRenderStage& initStage) {
	GraphicsInterface::beginPerformanceEvent("Spot");

	{ // Shadow Map
		std::vector<SpotLight*> spotLights = sceneContext.spotLights();

		for (std::vector<SpotLight*>::iterator light = spotLights.begin(); light != spotLights.end(); ++light) {
			if ((*light)->castsShadows()) {
				SpotLight* spotLight = (*light);
				renderShadowMap(spotLight, world);
			}
		}
	}

	{ // Lighting
		std::vector<SpotLight*> spotLights = sceneContext.spotLights();
		for (std::vector<SpotLight*>::iterator light = spotLights.begin(); light != spotLights.end(); ++light) {

			GraphicsInterface::beginPerformanceEvent("Light");

			SpotLight* spotLight = (*light);

			{ // render lighting
				IEffect* lightEffect = (*light)->castsShadows() ? lightEffectShadow_ : lightEffectNoShadow_;
				renderLight(spotLight, lightEffect, viewer, initStage.normalViewSpaceMap());
			}

			{ // accumulate into lightmap
				accumulateLight(spotLight, initStage.colorMap(), lightMapFrameBuffer);
			}

			GraphicsInterface::endPerformanceEvent();
		}
	}

	GraphicsInterface::endPerformanceEvent();
}
Beispiel #28
0
//[-------------------------------------------------------]
//[ Public virtual SceneQuery functions                   ]
//[-------------------------------------------------------]
bool SQPlaneSet::PerformQuery()
{
	// Get the hierarchy we are working on
	const SceneHierarchy *pHierarchy = GetSceneContainer().GetHierarchyInstance();
	if (!pHierarchy)
		return true;  // Error, but not cancelled by the user

	// Perform the query recursive...
	m_nFlags &= ~StopQuery;

	// ... get the scene context
	SceneContext *pSceneContext = GetSceneContext();
	if (pSceneContext) {
		pSceneContext->StartProcess();
		const bool bResult = PerformQueryRec(pHierarchy->GetRootNode());
		pSceneContext->EndProcess();

		// Done
		return bResult;
	} else {
		// Error!
		return false;
	}
}
Beispiel #29
0
// Draws the map with a offset, needed for scrolling
void
GroundMap::draw(SceneContext& gc)
{
  const Rect& display = gc.color().get_world_clip_rect();

  if (globals::draw_collision_map)
    draw_colmap(gc);

  // Trying to calc which parts of the tilemap needs to be drawn
  int start_x = Math::max(0, display.left / globals::tile_size);
  int start_y = Math::max(0, display.top  / globals::tile_size);
  int tilemap_width  = display.get_width()  / globals::tile_size + 1;
  int tilemap_height = display.get_height() / globals::tile_size + 1;

  // drawing the stuff
  for (int x = start_x; x <= (start_x + tilemap_width) && x < tile_width; ++x)
    for (int y = start_y; y <= start_y + tilemap_height && y < tile_height; ++y)
    {
      if (get_tile(x, y)->get_sprite())
      {
        gc.color().draw(get_tile(x, y)->get_sprite(),
                        Vector2i(x * globals::tile_size, y * globals::tile_size));
      }
      else
      {
        if (false)
        {
          gc.color().draw_fillrect(Rect(x * globals::tile_size,
                                        y * globals::tile_size,
                                        x * globals::tile_size + globals::tile_size,
                                        y * globals::tile_size + globals::tile_size),
                                   Color(255, 0, 0, 75));
        }
      }
    }
}
void
VRDummy::draw(SceneContext& sc)
{
  sc.highlight().push_modelview();
  sc.highlight().translate(pos.x, pos.y);
  sc.highlight().rotate(rotation, 0.0f, 1.0f, 0.0f);
  sprite.draw(sc.highlight(), Vector(0, 0), 1200.0f);
  sc.highlight().pop_modelview();

  sc.highlight().draw(highlight, pos, 1500.0f);
}