本文整理汇总了C++中VideoPtr::GetCameraPos方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoPtr::GetCameraPos方法的具体用法?C++ VideoPtr::GetCameraPos怎么用?C++ VideoPtr::GetCameraPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoPtr
的用法示例。
在下文中一共展示了VideoPtr::GetCameraPos方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTab
bool EditorBase::DrawTab(VideoPtr video, InputPtr input, const Vector2 &v2Pos, const float width, const wstring &text, Color color)
{
video->SetAlphaMode(Video::AM_PIXEL);
video->SetVertexShader(ShaderPtr());
video->SetPixelShader(ShaderPtr());
video->SetZBuffer(false);
video->SetZWrite(false);
const Vector2 v2Cam = video->GetCameraPos();
video->SetCameraPos(Vector2(0,0));
bool mouseOver = false;
if (mouseOver = ETHGlobal::PointInRect(input->GetCursorPositionF(video), v2Pos+Vector2(width/2, m_menuSize), Vector2(width, m_menuSize)))
{
if (color.a < 200)
color.a = 200;
}
const Vector2 v2CurveSize = m_curve->GetBitmapSizeF();
const float rectWidth = width-v2CurveSize.x*2;
m_curve->FlipX();
m_curve->Draw(v2Pos, color);
const Vector2 v2RectPos = v2Pos+Vector2(v2CurveSize.x, 0);
video->DrawRectangle(v2RectPos, Vector2(rectWidth, m_menuSize*2), color);
m_curve->FlipX();
m_curve->Draw(v2Pos+Vector2(v2CurveSize.x+rectWidth, 0), color);
ShadowPrint(v2RectPos+Vector2(v2CurveSize.x, m_menuSize/2), text.c_str(), L"Verdana14_shadow.fnt", Color(color.a,255,255,255));
video->SetCameraPos(v2Cam);
return (mouseOver && input->GetKeyState(GSK_LMOUSE) == GSKS_HIT);
}
示例2: ComputeDrawHash
float ETHEntityRenderingManager::ComputeDrawHash(VideoPtr video, const float entityDepth, const ETHSpriteEntity* entity) const
{
static const float precisionScale = 100.0f;
float drawHash;
float verticalHashShift;
const float screenHeight = video->GetScreenSize().y * precisionScale;
const float hashDepth = entityDepth * screenHeight;
switch (entity->GetType())
{
case ETHEntityProperties::ET_HORIZONTAL:
drawHash = hashDepth;
break;
case ETHEntityProperties::ET_VERTICAL:
verticalHashShift = ((entity->GetPositionY() - video->GetCameraPos().y) * precisionScale) / screenHeight;
drawHash = hashDepth + verticalHashShift + 0.1f;
break;
case ETHEntityProperties::ET_GROUND_DECAL:
case ETHEntityProperties::ET_OPAQUE_DECAL:
drawHash = hashDepth + 0.1f;
break;
default:
drawHash = hashDepth;
}
return drawHash;
}
示例3: GetInScreenOrigin
gs2d::math::Vector2 ETHParallaxManager::ComputeOffset(
const VideoPtr& video,
const Vector3 &pos,
const float& individualParallaxIntensity) const
{
const Vector2 screenSpacePos = Vector2(pos.x, pos.y) - video->GetCameraPos();
return ((screenSpacePos - GetInScreenOrigin(video)) / video->GetScreenSizeF().x) * pos.z * m_intensity * individualParallaxIntensity;
}
示例4: SetLightScissor
void ETHLight::SetLightScissor(const VideoPtr& video, const Vector2& zAxisDir) const
{
const float squareEdgeSize = range * 2.0f;
Vector2 sum(zAxisDir * pos.z * 2.0f);
sum.x = Abs(sum.x);
sum.y = Abs(sum.y);
const Vector2 squareSize(Vector2(squareEdgeSize, squareEdgeSize) + sum);
const Vector2 absPos(ETHGlobal::ToScreenPos(pos, zAxisDir) - video->GetCameraPos() - (squareSize * 0.5f));
video->SetScissor(Rect2D(absPos.ToVector2i(), squareSize.ToVector2i()));
}
示例5: DrawTopLayer
void ETHDrawableManager::DrawTopLayer(const unsigned int lastFrameElapsedTimeMS, const VideoPtr& video)
{
const Vector2 oldCamPos = video->GetCameraPos();
video->SetCameraPos(Vector2(0,0));
video->SetZBuffer(false);
video->SetZWrite(false);
video->SetSpriteDepth(0.0f);
for (std::list<boost::shared_ptr<ETHDrawable> >::iterator iter = m_drawableList.begin();
iter != m_drawableList.end(); ++iter)
{
const boost::shared_ptr<ETHDrawable>& drawable = (*iter);
drawable->Draw(lastFrameElapsedTimeMS);
}
video->SetCameraPos(oldCamPos);
}
示例6: ComputeFakeEyePosition
Vector3 ETHFakeEyePositionManager::ComputeFakeEyePosition(
VideoPtr video, ShaderPtr pShader, const bool drawToTarget,
const Vector3 &v3LightPos, const float entityAngle)
{
const Vector2 &v2CamPos(video->GetCameraPos());
const Vector2 &v2ScreenDim(video->GetScreenSizeF());
Vector3 v3RelativeEyePos(0, v2ScreenDim.y*1.5f, GetFakeEyeHeight());
if (!drawToTarget)
v3RelativeEyePos.y -= v3LightPos.y-v2CamPos.y;
Matrix4x4 matRot = RotateZ(-DegreeToRadian(entityAngle));
v3RelativeEyePos = Multiply(v3RelativeEyePos, matRot);
//pShader->SetConstant(GS_L("fakeEyePos"), v3RelativeEyePos+Vector3(0, v2CamPos.y, 0)+Vector3(v3LightPos.x,0,0));
return v3RelativeEyePos+Vector3(0, v2CamPos.y, 0)+Vector3(v3LightPos.x,0,0);
}
示例7: IsSphereInScreen
bool IsSphereInScreen(const Vector3& pos, const float radius, const Vector2& zAxisDir, const VideoPtr& video)
{
const Vector2 v2Pos(ToScreenPos(pos, zAxisDir));
const Vector2& v2Cam = video->GetCameraPos();
const Vector2& v2Screen = video->GetScreenSizeF();
const float minX = v2Cam.x - radius;
const float maxX = v2Cam.x + v2Screen.x + radius;
const float minY = v2Cam.y - radius;
const float maxY = v2Cam.y + v2Screen.y + radius;
if (v2Pos.x < minX || v2Pos.x > maxX || v2Pos.y < minY || v2Pos.y > maxY)
{
return false;
}
else
{
return true;
}
}
示例8: Start
void ETHEngine::Start(VideoPtr video, InputPtr input, AudioPtr audio)
{
Platform::FileIOHubPtr fileIOHub = video->GetFileIOHub();
ETHAppEnmlFile file(fileIOHub->GetResourceDirectory() + ETH_APP_PROPERTIES_FILE, fileIOHub->GetFileManager(), video->GetPlatformName());
m_richLighting = file.IsRichLightingEnabled();
m_provider = ETHResourceProviderPtr(new ETHResourceProvider(
ETHGraphicResourceManagerPtr(new ETHGraphicResourceManager(file.GetDensityManager())),
ETHAudioResourceManagerPtr(new ETHAudioResourceManager()),
ETHShaderManagerPtr(new ETHShaderManager(video, fileIOHub->GetStartResourceDirectory() + ETHDirectories::GetShaderDirectory(), m_richLighting)),
video, audio, input, fileIOHub, false));
m_ethInput.SetProvider(m_provider);
CreateDynamicBackBuffer(file);
if (!m_pASEngine)
{
video->SetBGColor(gs2d::constant::BLACK);
if (!PrepareScriptingEngine(file.GetDefinedWords()))
{
Abort();
return;
}
if (m_compileAndRun)
{
if (!RunMainFunction(GetMainFunctionId()))
{
Abort();
return;
}
video->EnableQuitShortcuts(true);
m_v2LastCamPos = video->GetCameraPos();
}
}
else
{
video->SetBGColor(m_lastBGColor);
m_pScene->RecoverResources();
}
}
示例9: GetAbsolutePos
inline Vector2 GetAbsolutePos(InputPtr input, VideoPtr video)
{
return input->GetTouchPos(0, video) + video->GetCameraPos();
}