本文整理汇总了C++中CBaseGroundDrawer::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseGroundDrawer::Draw方法的具体用法?C++ CBaseGroundDrawer::Draw怎么用?C++ CBaseGroundDrawer::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseGroundDrawer
的用法示例。
在下文中一共展示了CBaseGroundDrawer::Draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawRefraction
void CDynWater::DrawRefraction(CGame* game)
{
drawRefraction=true;
camera->Update(false);
refractRight=camera->right;
refractUp=camera->up;
refractForward=camera->forward;
refractFBO.Bind();
glViewport(0,0,refractSize,refractSize);
glClearColor(mapInfo->atmosphere.fogColor[0],mapInfo->atmosphere.fogColor[1],mapInfo->atmosphere.fogColor[2],1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
float3 oldsun=unitDrawer->unitSunColor;
float3 oldambient=unitDrawer->unitAmbientColor;
unitDrawer->unitSunColor*=float3(0.5f,0.7f,0.9f);
unitDrawer->unitAmbientColor*=float3(0.6f,0.8f,1.0f);
game->SetDrawMode(CGame::refractionDraw);
CBaseGroundDrawer *gd = readmap->GetGroundDrawer();
gd->Draw(false,false,dwGroundRefractVP);
glEnable(GL_CLIP_PLANE2);
double plane[4]={0,-1,0,2};
glClipPlane(GL_CLIP_PLANE2 ,plane);
drawReflection=true;
unitDrawer->Draw(false,true);
featureDrawer->Draw();
unitDrawer->DrawCloakedUnits(true,true);
featureDrawer->DrawFadeFeatures(true,true); // FIXME: Make it fade out correctly without "noAdvShading"
drawReflection=false;
ph->Draw(false,true);
eventHandler.DrawWorldRefraction();
glDisable(GL_CLIP_PLANE2);
game->SetDrawMode(CGame::normalDraw);
drawRefraction=false;
glViewport(gu->viewPosX,0,gu->viewSizeX,gu->viewSizeY);
glClearColor(mapInfo->atmosphere.fogColor[0],mapInfo->atmosphere.fogColor[1],mapInfo->atmosphere.fogColor[2],1);
unitDrawer->unitSunColor=oldsun;
unitDrawer->unitAmbientColor=oldambient;
}
示例2: Draw
void CWorldDrawer::Draw()
{
SCOPED_TIMER("WorldDrawer::Total");
CBaseGroundDrawer* gd = readmap->GetGroundDrawer();
if (globalRendering->drawSky) {
sky->Draw();
}
if (globalRendering->drawGround) {
SCOPED_TIMER("WorldDrawer::Terrain");
gd->Draw(DrawPass::Normal);
smoothHeightMeshDrawer->Draw(1.0f);
treeDrawer->DrawGrass();
gd->DrawTrees();
}
if (globalRendering->drawWater && !mapInfo->map.voidWater) {
SCOPED_TIMER("WorldDrawer::Water");
water->OcclusionQuery();
if (water->IsDrawSolid()) {
water->UpdateWater(game);
water->Draw();
}
}
selectedUnits.Draw();
eventHandler.DrawWorldPreUnit();
{
SCOPED_TIMER("WorldDrawer::Models");
DebugColVolDrawer::Draw();
unitDrawer->Draw(false);
modelDrawer->Draw();
featureDrawer->Draw();
pathDrawer->DrawAll();
}
//! transparent stuff
glEnable(GL_BLEND);
glDepthFunc(GL_LEQUAL);
const bool noAdvShading = shadowHandler->shadowsLoaded;
static const double plane_below[4] = {0.0f, -1.0f, 0.0f, 0.0f};
static const double plane_above[4] = {0.0f, 1.0f, 0.0f, 0.0f};
{
glClipPlane(GL_CLIP_PLANE3, plane_below);
glEnable(GL_CLIP_PLANE3);
//! draw cloaked objects below water surface
unitDrawer->DrawCloakedUnits(noAdvShading);
featureDrawer->DrawFadeFeatures(noAdvShading);
glDisable(GL_CLIP_PLANE3);
}
//! draw water
if (globalRendering->drawWater && !mapInfo->map.voidWater) {
SCOPED_TIMER("WorldDrawer::Water");
if (!water->IsDrawSolid()) {
//! Water rendering will overwrite features, so save them
featureDrawer->SwapFeatures();
water->UpdateWater(game);
water->Draw();
featureDrawer->SwapFeatures();
}
}
{
glClipPlane(GL_CLIP_PLANE3, plane_above);
glEnable(GL_CLIP_PLANE3);
//! draw cloaked objects above water surface
unitDrawer->DrawCloakedUnits(noAdvShading);
featureDrawer->DrawFadeFeatures(noAdvShading);
glDisable(GL_CLIP_PLANE3);
}
{
SCOPED_TIMER("WorldDrawer::Projectiles");
projectileDrawer->Draw(false);
}
if (globalRendering->drawSky) {
sky->DrawSun();
}
eventHandler.DrawWorld();
LuaUnsyncedCtrl::DrawUnitCommandQueues();
if (cmdColors.AlwaysDrawQueue() || guihandler->GetQueueKeystate()) {
selectedUnits.DrawCommands();
}
//.........这里部分代码省略.........
示例3: DrawReflection
void CDynWater::DrawReflection(CGame* game)
{
// CCamera *realCam = camera;
// camera = new CCamera(*realCam);
char realCam[sizeof(CCamera)];
new (realCam) CCamera(*camera); // anti-crash workaround for multithreading
camera->forward.y *= -1.0f;
camera->pos.y *= -1.0f;
camera->pos.y += 0.2f;
camera->Update(false);
reflectRight=camera->right;
reflectUp=camera->up;
reflectForward=camera->forward;
reflectFBO.Bind();
glViewport(0,0,512,512);
glClearColor(0.5f,0.6f,0.8f,0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
game->SetDrawMode(CGame::reflectionDraw);
sky->Draw();
glEnable(GL_CLIP_PLANE2);
double plane2[4]={0,-1,0,1.0f};
glClipPlane(GL_CLIP_PLANE2 ,plane2);
drawReflection=true;
bool drawShadows=shadowHandler->drawShadows;
shadowHandler->drawShadows=false;
CBaseGroundDrawer *gd = readmap->GetGroundDrawer ();
gd->Draw(true,false,dwGroundReflectIVP);
double plane[4]={0,1,0,1.0f};
glClipPlane(GL_CLIP_PLANE2 ,plane);
gd->Draw(true);
shadowHandler->drawShadows=drawShadows;
unitDrawer->Draw(true);
featureDrawer->Draw();
unitDrawer->DrawCloakedUnits(false,true);
featureDrawer->DrawFadeFeatures(false,true);
ph->Draw(true);
eventHandler.DrawWorldReflection();
sky->DrawSun();
game->SetDrawMode(CGame::normalDraw);
drawReflection=false;
glDisable(GL_CLIP_PLANE2);
glViewport(gu->viewPosX,0,gu->viewSizeX,gu->viewSizeY);
glClearColor(mapInfo->atmosphere.fogColor[0],mapInfo->atmosphere.fogColor[1],mapInfo->atmosphere.fogColor[2],1);
// delete camera;
// camera = realCam;
camera->~CCamera();
new (camera) CCamera(*(CCamera *)realCam);
camera->Update(false);
}