Address comments on commit d7bc28a
parent
596bb49de0
commit
0c9cf51d81
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include "graphics/engine/planet.h"
|
#include "graphics/engine/planet.h"
|
||||||
|
|
||||||
|
#include "common/event.h"
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
@ -31,7 +33,7 @@ namespace Gfx
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
const int PLANET_PREALLOCATE_COUNT = 10;
|
const int PLANET_PREALLOCATE_COUNT = 20;
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +41,6 @@ CPlanet::CPlanet(CEngine* engine)
|
||||||
: m_engine(engine)
|
: m_engine(engine)
|
||||||
{
|
{
|
||||||
m_planets.reserve(PLANET_PREALLOCATE_COUNT);
|
m_planets.reserve(PLANET_PREALLOCATE_COUNT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlanet::~CPlanet()
|
CPlanet::~CPlanet()
|
||||||
|
@ -143,17 +144,13 @@ void CPlanet::Draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlanet::Create(int mode, Math::Point start, float dim, float speed,
|
void CPlanet::Create(PlanetType type, Math::Point start, float dim, float speed,
|
||||||
float dir, const std::string& name, Math::Point uv1, Math::Point uv2,
|
float dir, const std::string& name, Math::Point uv1, Math::Point uv2,
|
||||||
bool transparent)
|
bool transparent)
|
||||||
{
|
{
|
||||||
if (mode < 0) mode = 0;
|
|
||||||
if (mode > 1) mode = 1;
|
|
||||||
|
|
||||||
Planet planet;
|
Planet planet;
|
||||||
|
|
||||||
// TODO: refactor mode to planet type in interface
|
planet.type = type;
|
||||||
planet.type = (mode == 0) ? PlanetType::Sky : PlanetType::OuterSpace;
|
|
||||||
planet.start = start;
|
planet.start = start;
|
||||||
planet.angle = start;
|
planet.angle = start;
|
||||||
planet.dim = dim;
|
planet.dim = dim;
|
||||||
|
|
|
@ -24,12 +24,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/event.h"
|
#include "graphics/engine/planet_type.h"
|
||||||
|
|
||||||
#include "math/point.h"
|
#include "math/point.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
struct Event;
|
||||||
|
|
||||||
// Graphics module namespace
|
// Graphics module namespace
|
||||||
namespace Gfx
|
namespace Gfx
|
||||||
|
@ -37,16 +38,6 @@ namespace Gfx
|
||||||
|
|
||||||
class CEngine;
|
class CEngine;
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum PlanetType
|
|
||||||
* \brief Type of planet which determines when it is displayed
|
|
||||||
*/
|
|
||||||
enum PlanetType
|
|
||||||
{
|
|
||||||
Sky, //!< normal planets, orbiting in the sky
|
|
||||||
OuterSpace //!< only visible during spaceship flight
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class CPlanet
|
* \class CPlanet
|
||||||
* \brief Planet manager
|
* \brief Planet manager
|
||||||
|
@ -66,7 +57,7 @@ public:
|
||||||
//! Management of an event
|
//! Management of an event
|
||||||
bool EventProcess(const Event &event);
|
bool EventProcess(const Event &event);
|
||||||
//! Creates a new planet
|
//! Creates a new planet
|
||||||
void Create(int mode, Math::Point start, float dim, float speed, float dir,
|
void Create(PlanetType type, Math::Point start, float dim, float speed, float dir,
|
||||||
const std::string& name, Math::Point uv1, Math::Point uv2,
|
const std::string& name, Math::Point uv1, Math::Point uv2,
|
||||||
bool transparent);
|
bool transparent);
|
||||||
//! Indicates if there is at least one planet
|
//! Indicates if there is at least one planet
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Colobot: Gold Edition source code
|
||||||
|
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||||
|
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see http://gnu.org/licenses
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Gfx
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \enum PlanetType
|
||||||
|
* \brief Type of planet which determines when it is displayed
|
||||||
|
*/
|
||||||
|
enum PlanetType
|
||||||
|
{
|
||||||
|
Sky, //!< normal planets, orbiting in the sky
|
||||||
|
OuterSpace //!< only visible during spaceship flight
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Gfx
|
|
@ -895,6 +895,17 @@ MissionType CLevelParserParam::AsMissionType(MissionType def)
|
||||||
return AsMissionType();
|
return AsMissionType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gfx::PlanetType CLevelParserParam::AsPlanetType()
|
||||||
|
{
|
||||||
|
Gfx::PlanetType planetType{};
|
||||||
|
|
||||||
|
if (m_value == "0")
|
||||||
|
planetType = Gfx::PlanetType::Sky;
|
||||||
|
else if (m_value == "1")
|
||||||
|
planetType = Gfx::PlanetType::OuterSpace;
|
||||||
|
|
||||||
|
return planetType;
|
||||||
|
}
|
||||||
|
|
||||||
void CLevelParserParam::ParseArray()
|
void CLevelParserParam::ParseArray()
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "graphics/core/color.h"
|
#include "graphics/core/color.h"
|
||||||
|
|
||||||
#include "graphics/engine/camera.h"
|
#include "graphics/engine/camera.h"
|
||||||
|
#include "graphics/engine/planet_type.h"
|
||||||
#include "graphics/engine/pyro_type.h"
|
#include "graphics/engine/pyro_type.h"
|
||||||
#include "graphics/engine/water.h"
|
#include "graphics/engine/water.h"
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ public:
|
||||||
Gfx::CameraType AsCameraType();
|
Gfx::CameraType AsCameraType();
|
||||||
MissionType AsMissionType();
|
MissionType AsMissionType();
|
||||||
const CLevelParserParamVec& AsArray();
|
const CLevelParserParamVec& AsArray();
|
||||||
|
Gfx::PlanetType AsPlanetType();
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
//! Get value (returns default if not found, throws exception if unable to process)
|
//! Get value (returns default if not found, throws exception if unable to process)
|
||||||
|
|
|
@ -3152,7 +3152,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||||
ppos = line->GetParam("pos")->AsPoint();
|
ppos = line->GetParam("pos")->AsPoint();
|
||||||
uv1 = line->GetParam("uv1")->AsPoint();
|
uv1 = line->GetParam("uv1")->AsPoint();
|
||||||
uv2 = line->GetParam("uv2")->AsPoint();
|
uv2 = line->GetParam("uv2")->AsPoint();
|
||||||
m_planet->Create(line->GetParam("mode")->AsInt(0),
|
m_planet->Create(line->GetParam("mode")->AsPlanetType(),
|
||||||
Math::Point(ppos.x, ppos.z),
|
Math::Point(ppos.x, ppos.z),
|
||||||
line->GetParam("dim")->AsFloat(0.2f),
|
line->GetParam("dim")->AsFloat(0.2f),
|
||||||
line->GetParam("speed")->AsFloat(0.0f),
|
line->GetParam("speed")->AsFloat(0.0f),
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Colobot: Gold Edition source code
|
||||||
|
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||||
|
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see http://gnu.org/licenses
|
||||||
|
*/
|
||||||
|
|
||||||
#include "sound/oalsound/check.h"
|
#include "sound/oalsound/check.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
Loading…
Reference in New Issue