本文整理汇总了C++中Landscape类的典型用法代码示例。如果您正苦于以下问题:C++ Landscape类的具体用法?C++ Landscape怎么用?C++ Landscape使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Landscape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLandscape
void Test::PreparePath()
{
SettingsManager *settings = SettingsManager::Instance();
int32 partX = settings->GetLandscapePartitioning().x;
int32 partY = settings->GetLandscapePartitioning().y;
Landscape *land = GetLandscape();
AABBox3 boundingBox = land->GetBoundingBox();
Vector3 min = boundingBox.min;
Vector3 max = boundingBox.max;
float32 landWidth = max.x - min.x;
float32 landLength = max.y - min.y;
Vector2 rectSize(landWidth / partX, landLength / partY);
int32 x = 0;
int32 xDir = 1;
for(int32 y = 0; y < partY; ++y)
{
Rect curRect;
for(int32 i = 0; i < partX; ++i, x += xDir)
{
Vector2 v;
v.Set(min.x + x * rectSize.x, min.y + y * rectSize.y);
curRect.SetPosition(v);
curRect.SetSize(rectSize);
rectSequence.push_back(curRect);
}
x -= xDir;
xDir = -xDir;
}
}
示例2: Landscape
Landscape* DynamicModelNoColor::_imageToLandscape(Image* img)
{
Landscape* land = new Landscape();
float begin = 0;
bool color = img->at(0);
uint i = 0;
for (i = 0; i < img->size(); i++)
{
if ((bool)img->at(i) != color)
{
if (color)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI));
}
begin = i;
color = img->at(i);
}
}
if (color)
{
land->push_back(new LandscapeElem(false, (i + begin - 1 - VIEW_ANGLE) / 2. / 360. * PI,
(i - begin) / 360. * PI));
}
return land;
}
示例3: GetActiveEditor
void CommandCopyPasteHeightmap::UpdateLandscapeTilemap(DAVA::Image *image)
{
Texture* texture = Texture::CreateFromData(image->GetPixelFormat(), image->GetData(), image->GetWidth(), image->GetHeight(), false);
texture->relativePathname = tilemapSavedPathname;
texture->GenerateMipmaps();
texture->SetWrapMode(Texture::WRAP_REPEAT, Texture::WRAP_REPEAT);
LandscapeEditorBase* editor = GetActiveEditor();
if (editor)
{
editor->UpdateLandscapeTilemap(texture);
}
else
{
SceneEditorScreenMain *screen = dynamic_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen());
EditorScene* scene = screen->FindCurrentBody()->bodyControl->GetScene();
Landscape* landscape = scene->GetLandscape(scene);
landscape->SetTexture(Landscape::TEXTURE_TILE_MASK, texture);
landscape->UpdateFullTiledTexture();
ImageLoader::Save(image, tilemapSavedPathname);
}
SafeRelease(texture);
}
示例4: Landscape
Landscape* CCmodel::_imageToLandscape(Image* img)
{
Landscape* land = new Landscape();
int lastPixelColor = img->at(0);
int lastObjBegin = 0;
uint i = 0;
for (; i < img->size(); ++i)
{
if (img->at(i) == lastPixelColor)
continue;
if (img->at(i) != BLACK && lastPixelColor != BLACK)
{
lastPixelColor = img->at(i);
continue;
}
LandscapeElem* object = new LandscapeElem(lastPixelColor == BLACK,
((((lastObjBegin + i - 1) / 2.) - VIEW_ANGLE / 2) / 360.) * 2 * PI,
((float)(i - lastObjBegin) / 360.) * 2 * PI);
land->push_back(object);
lastObjBegin = i;
lastPixelColor = img->at(i);
}
LandscapeElem* object = new LandscapeElem(lastPixelColor == BLACK,
((((lastObjBegin + i - 1) / 2.) - VIEW_ANGLE / 2) / 360.) * 2 * PI,
((float)(i - lastObjBegin) / 360.) * 2 * PI);
land->push_back(object);
return land;
}
示例5: EditorHeightmap
bool LandscapesController::ShowEditorLandscape(EditorLandscape *displayingLandscape)
{
Landscape *landscape = EditorScene::GetLandscape(scene);
if (!landscape)
{
Logger::Error("[LandscapesController::ShowEditorLandscape] Can be only one landscape");
return false;
}
displayingLandscape->SetNestedLandscape(landscape);
if(!landscapeRenderer)
{
renderedHeightmap = new EditorHeightmap(landscape->GetHeightmap());
landscapeRenderer = new LandscapeRenderer(renderedHeightmap, landscape->GetBoundingBox());
displayingLandscape->SetHeightmap(renderedHeightmap);
}
displayingLandscape->SetRenderer(landscapeRenderer);
//TODO: remove SetWorldTransformPtr
displayingLandscape->SetWorldTransformPtr(landscape->GetWorldTransformPtr());
Entity* lanscapeNode = EditorScene::GetLandscapeNode(scene);
lanscapeNode->RemoveComponent(Component::RENDER_COMPONENT);
RenderComponent* component = new RenderComponent(displayingLandscape);
lanscapeNode->AddComponent(component);
currentLandscape = displayingLandscape;
return true;
}
示例6: display
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//Dibuja el paisaje
Landscape * landscape = new Landscape;
landscape->draw();
glFlush();
}
示例7: FindLandscape
void EditorBodyControl::RecreteFullTilingTexture()
{
Landscape *landscape = FindLandscape(scene);
if (landscape)
{
landscape->UpdateFullTiledTexture();
}
}
示例8: SubFromDistribution
void JoinedLandscape::SubFromDistribution( string & itsConfig )
{
unsigned short int strLength = itsConfig.length() / 2;
d[itsConfig].SubFromDist();
string first = itsConfig;
first.replace ( strLength, strLength*2, strLength, '0' );
string second = itsConfig;
second.replace ( 0, strLength, strLength, '0' );
LOne.SubFromDistribution(first);
LTwo.SubFromDistribution(second);
}
示例9: realPoint
Vector3 Test::GetRealPoint(const Vector2& point)
{
Vector3 realPoint(point);
Landscape *land = GetLandscape();
land->PlacePoint(realPoint, realPoint);
realPoint.z += SettingsManager::Instance()->GetCameraElevation();
return realPoint;
}
示例10: Move
bool Entity::Move( string destination, Landscape & LJoined )
{
if ( destination == "EMPTY" ) { return 0; }
string previous = itsPayoff.GetConfig();
LJoined.SubFromDistribution( previous );
// cout << "Move from " << itsPayoff.GetConfig() << ":" << itsPayoff.GetFitness() << " to ";
itsPayoff.SetConfig( destination );
itsPayoff.SetFitness( LJoined.d[destination].GetFitness() ) ;
// cout << "to " << itsPayoff.GetConfig() << ":" << itsPayoff.GetFitness() << endl;
LJoined.AddToDistribution( destination );
movesTaken++;
return 1;
}
示例11: Vector2
void LandscapeEditorHeightmap::UpdateCursor()
{
if(currentTool)
{
float32 scaleSize = (float32)((int32)currentTool->size);
Vector2 pos = landscapePoint - Vector2(scaleSize, scaleSize)/2.f;
Landscape *landscape = landscapesController->GetCurrentLandscape();
landscape->SetCursorTexture(cursorTexture);
landscape->SetBigTextureSize((float32)landscapeSize);
landscape->SetCursorPosition(pos);
landscape->SetCursorScale(scaleSize);
}
}
示例12: GetLandscape
void FoliageSystem::SyncFoliageWithLandscape()
{
if(landscapeEntity && foliageEntity)
{
Landscape* landscapeRO = GetLandscape(landscapeEntity);
VegetationRenderObject* vegetationRO = GetVegetation(foliageEntity);
vegetationRO->SetHeightmap(landscapeRO->GetHeightmap());
vegetationRO->SetHeightmapPath(landscapeRO->GetHeightmapPathname());
vegetationRO->SetWorldSize(Vector3(landscapeRO->GetLandscapeSize(),
landscapeRO->GetLandscapeSize(),
landscapeRO->GetLandscapeHeight()));
}
}
示例13: DVASSERT
void SceneSaver::SaveScene(Scene *scene, const FilePath &fileName, Set<String> &errorLog)
{
DVASSERT(0 == texturesForSave.size())
String relativeFilename = fileName.GetRelativePathname(sceneUtils.dataSourceFolder);
sceneUtils.workingFolder = fileName.GetDirectory().GetRelativePathname(sceneUtils.dataSourceFolder);
FileSystem::Instance()->CreateDirectory(sceneUtils.dataFolder + sceneUtils.workingFolder, true);
scene->Update(0.1f);
FilePath oldPath = SceneValidator::Instance()->SetPathForChecking(sceneUtils.dataSourceFolder);
SceneValidator::Instance()->ValidateScene(scene, errorLog);
texturesForSave.clear();
SceneDataManager::EnumerateTextures(scene, texturesForSave);
CopyTextures(scene, errorLog);
ReleaseTextures();
Landscape *landscape = EditorScene::GetLandscape(scene);
if (landscape)
{
sceneUtils.CopyFile(landscape->GetHeightmapPathname(), errorLog);
}
CopyReferencedObject(scene, errorLog);
CopyEffects(scene, errorLog);
CopyCustomColorTexture(scene, fileName.GetDirectory(), errorLog);
//save scene to new place
FilePath tempSceneName = sceneUtils.dataSourceFolder + relativeFilename;
tempSceneName.ReplaceExtension(".saved.sc2");
SceneFileV2 * outFile = new SceneFileV2();
outFile->EnableSaveForGame(true);
outFile->EnableDebugLog(false);
outFile->SaveScene(tempSceneName, scene);
SafeRelease(outFile);
bool moved = FileSystem::Instance()->MoveFile(tempSceneName, sceneUtils.dataFolder + relativeFilename, true);
if(!moved)
{
errorLog.insert(Format("Can't move file %s", fileName.GetAbsolutePathname().c_str()));
}
SceneValidator::Instance()->SetPathForChecking(oldPath);
}
示例14: UpdateLandscapeHeightmap
void HeightmapModificationCommand::UpdateLandscapeHeightmap(String filename)
{
SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
LandscapesController* landscapesController = activeScene->GetLandscapesController();
Landscape* landscapeNode = landscapesController->GetCurrentLandscape();
Heightmap* heightmap = new Heightmap();
heightmap->Load(filename);
landscapeNode->SetHeightmap(heightmap);
heightmap->Save(landscapeNode->GetHeightmapPathname());
SafeRelease(heightmap);
}
示例15: genDVector
void JoinedLandscape::genDVector()
{
int counter;
int T = pow( 2, itsN );
double average = 0;
string configuration;
string configuration2;
for ( counter = 0 ; counter < T ; counter++ )
{
genConfig( counter, configuration, itsN);
configuration2 = flipConfigString ( configuration );
average = (LOne.GetFitness( configuration ) + LTwo.GetFitness( configuration2 ) ) / (double) 2;
d.insert( pair<string,Payoff> ( configuration, Payoff(configuration, average) ) );
}
}