示例#1
0
void oms::SingleImageChain::setViewCut(const ossimDrect& rect, bool imageSpaceFlag)
{
   if(!imageSpaceFlag)
   {
      
      const ossimProjection* proj = getViewProjection();
      
      if(proj)
      {
         std::vector<ossimGpt> pointList(4);
         proj->lineSampleToWorld(rect.ul(), pointList[0]);
         proj->lineSampleToWorld(rect.ur(), pointList[1]);
         proj->lineSampleToWorld(rect.lr(), pointList[2]);
         proj->lineSampleToWorld(rect.ll(), pointList[3]);
         setViewCut(pointList);
      }
   }
   else
   {
      std::vector<ossimDpt> pointList(4);
      pointList[0] = rect.ul();
      pointList[1] = rect.ur();
      pointList[2] = rect.lr();
      pointList[3] = rect.ll();
      theViewCutter->setEnableFlag(false);
      theViewImageCutter->setEnableFlag(true);
      theViewImageCutter->setPolygon(pointList);
      theViewImageCutter->initialize();
      ossimPropertyEvent evt(theViewImageCutter);
      theViewImageCutter->propagateEventToOutputs(evt);
   }
}
void TCompLightDirShadowsDynamic::activate() {
	PROFILE_FUNCTION("shadows: activate");
	if (!is_inRoom) return;
	if (!enabled) return;
	CHandle owner = CHandle(this).getOwner();
	activateWorldMatrix(getViewProjection().Invert());
	rt_shadows->getZTexture()->activate(TEXTURE_SLOT_SHADOWMAP);
	uploadShaderCtes(owner);
}
void printOE(std::string name, entityx::Entity entity, entityx::EntityManager &entities, entityx::EventManager &events)
{
    auto vp = getViewProjection(entities);
    
    auto pos = entity.component<Position>()->pos;
    assert(pos != glm::vec3());
    auto pos2d = getVec2(vp, pos);
    events.emit<GUITextEvent>(entity, pos2d, 15.0f, name);
};
void TCompCamera::render() const {
#ifndef NDEBUG
	PROFILE_FUNCTION("TCompCamera render");
	auto axis = Resources.get("frustum.mesh")->as<CMesh>();
	shader_ctes_object.World = getViewProjection().Invert();
	shader_ctes_object.uploadToGPU();
	axis->activateAndRender();
#endif
}
示例#5
0
        Vector2 Camera::projectPoint(const Vector3& src) const
        {
            Vector2 screenPos;

            auto viewport = sharedEngine->getRenderer()->getSize();
            Vector4 clipPos;

            getViewProjection().transformVector(Vector4(src.x, src.y, src.z, 1.0f), clipPos);

            assert(clipPos.w != 0.0f);
            Vector2 ndc(clipPos.x / clipPos.w, clipPos.y / clipPos.w);

            screenPos.x = (ndc.x + 1.0f) * 0.5f * viewport.width;
            screenPos.y = (ndc.y + 1.0f) * 0.5f * viewport.height;

            return screenPos;
        }