2003-01-26 19:04:46 -07:00
|
|
|
// deepskyobj.h
|
|
|
|
//
|
|
|
|
// Copyright (C) 2003, Chris Laurel <claurel@shatters.net>
|
|
|
|
//
|
|
|
|
// 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 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
#ifndef _CELENGINE_DEEPSKYOBJ_H_
|
|
|
|
#define _CELENGINE_DEEPSKYOBJ_H_
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
2020-03-05 00:38:35 -07:00
|
|
|
#include <celengine/astroobj.h>
|
2003-01-26 19:04:46 -07:00
|
|
|
#include <celengine/parser.h>
|
2019-08-15 13:21:22 -06:00
|
|
|
#include <celcompat/filesystem.h>
|
2009-07-20 21:14:29 -06:00
|
|
|
#include <Eigen/Core>
|
|
|
|
#include <Eigen/Geometry>
|
2003-01-26 19:04:46 -07:00
|
|
|
|
2018-12-03 09:41:31 -07:00
|
|
|
class Selection;
|
2018-12-04 13:00:36 -07:00
|
|
|
class Renderer;
|
2020-05-12 09:51:25 -06:00
|
|
|
struct Matrices;
|
2018-12-03 09:41:31 -07:00
|
|
|
|
2021-12-15 07:07:12 -07:00
|
|
|
constexpr inline float DSO_DEFAULT_ABS_MAGNITUDE = -1000.0f;
|
2003-01-26 19:04:46 -07:00
|
|
|
|
2005-02-10 23:09:37 -07:00
|
|
|
class Nebula;
|
|
|
|
class Galaxy;
|
2008-09-20 08:17:39 -06:00
|
|
|
class Globular;
|
2005-02-10 23:09:37 -07:00
|
|
|
class OpenCluster;
|
|
|
|
|
2020-03-05 00:38:35 -07:00
|
|
|
class DeepSkyObject : public AstroObject
|
2003-01-26 19:04:46 -07:00
|
|
|
{
|
|
|
|
public:
|
2018-12-03 09:41:31 -07:00
|
|
|
virtual Selection toSelection();
|
2018-09-22 07:13:49 -06:00
|
|
|
DeepSkyObject() = default;
|
|
|
|
virtual ~DeepSkyObject() = default;
|
2003-01-26 19:04:46 -07:00
|
|
|
|
2009-07-20 21:14:29 -06:00
|
|
|
Eigen::Vector3d getPosition() const;
|
|
|
|
void setPosition(const Eigen::Vector3d&);
|
2018-03-11 07:12:58 -06:00
|
|
|
|
|
|
|
static void hsv2rgb( float*, float*, float*, float, float, float);
|
|
|
|
|
|
|
|
virtual const char* getType() const = 0;
|
2005-11-18 02:00:39 -07:00
|
|
|
virtual void setType(const std::string&) = 0;
|
2018-10-14 06:56:04 -06:00
|
|
|
virtual std::string getDescription() const;
|
2003-01-26 19:04:46 -07:00
|
|
|
|
2009-07-20 21:14:29 -06:00
|
|
|
Eigen::Quaternionf getOrientation() const;
|
|
|
|
void setOrientation(const Eigen::Quaternionf&);
|
2003-01-26 19:04:46 -07:00
|
|
|
|
2008-10-22 17:29:28 -06:00
|
|
|
/*! Return the radius of a bounding sphere large enough to contain the object.
|
|
|
|
* For correct rendering, all of the geometry must fit within this sphere radius.
|
|
|
|
* DSO subclasses an alternate radius that more closely matches the conventional
|
|
|
|
* astronomical definition for the size of the object (e.g. mu25 isophote radius.)
|
|
|
|
*/
|
|
|
|
virtual float getBoundingSphereRadius() const { return radius; }
|
|
|
|
|
|
|
|
/*! Return the radius of the object. This radius will be displayed in the UI and
|
|
|
|
* should match the conventional astronomical definition of the object size.
|
2018-03-11 07:12:58 -06:00
|
|
|
*/
|
2008-10-22 17:29:28 -06:00
|
|
|
float getRadius() const { return radius; }
|
|
|
|
void setRadius(float r);
|
2009-02-03 13:21:36 -07:00
|
|
|
virtual float getHalfMassRadius() const { return radius; }
|
2018-03-11 07:12:58 -06:00
|
|
|
|
2005-07-12 11:37:00 -06:00
|
|
|
float getAbsoluteMagnitude() const;
|
|
|
|
void setAbsoluteMagnitude(float);
|
|
|
|
|
2018-12-06 12:47:47 -07:00
|
|
|
const std::string& getInfoURL() const;
|
2003-02-20 01:34:19 -07:00
|
|
|
void setInfoURL(const std::string&);
|
|
|
|
|
2008-08-06 23:35:29 -06:00
|
|
|
bool isVisible() const { return visible; }
|
|
|
|
void setVisible(bool _visible) { visible = _visible; }
|
2008-09-09 14:48:28 -06:00
|
|
|
bool isClickable() const { return clickable; }
|
|
|
|
void setClickable(bool _clickable) { clickable = _clickable; }
|
2008-08-06 23:35:29 -06:00
|
|
|
|
2018-03-11 07:12:58 -06:00
|
|
|
|
|
|
|
virtual const char* getObjTypeName() const = 0;
|
2007-04-02 01:55:49 -06:00
|
|
|
|
2021-11-13 14:42:26 -07:00
|
|
|
virtual bool pick(const Eigen::ParametrizedLine<double, 3>& ray,
|
2006-12-08 12:19:29 -07:00
|
|
|
double& distanceToPicker,
|
2007-01-07 17:03:07 -07:00
|
|
|
double& cosAngleToBoundCenter) const = 0;
|
2019-08-15 13:21:22 -06:00
|
|
|
virtual bool load(AssociativeArray*, const fs::path& resPath);
|
2018-12-05 10:09:22 -07:00
|
|
|
virtual void render(const Eigen::Vector3f& offset,
|
2009-07-24 18:28:19 -06:00
|
|
|
const Eigen::Quaternionf& viewerOrientation,
|
2003-01-26 19:04:46 -07:00
|
|
|
float brightness,
|
2018-12-04 13:00:36 -07:00
|
|
|
float pixelSize,
|
2020-05-12 09:51:25 -06:00
|
|
|
const Matrices& m,
|
2020-06-14 10:06:05 -06:00
|
|
|
Renderer*) = 0;
|
2003-01-26 19:04:46 -07:00
|
|
|
|
2019-07-06 06:37:18 -06:00
|
|
|
virtual uint64_t getRenderMask() const { return 0; }
|
2005-11-18 02:00:39 -07:00
|
|
|
virtual unsigned int getLabelMask() const { return 0; }
|
|
|
|
|
2003-01-26 19:04:46 -07:00
|
|
|
private:
|
2018-08-09 09:25:54 -06:00
|
|
|
Eigen::Vector3d position{ Eigen::Vector3d::Zero() };
|
2018-09-22 07:13:49 -06:00
|
|
|
Eigen::Quaternionf orientation{ Eigen::Quaternionf::Identity() };
|
|
|
|
float radius{ 1 };
|
|
|
|
float absMag{ DSO_DEFAULT_ABS_MAGNITUDE } ;
|
2018-08-09 09:25:54 -06:00
|
|
|
std::string infoURL;
|
2018-09-22 07:13:49 -06:00
|
|
|
|
|
|
|
bool visible { true };
|
|
|
|
bool clickable { true };
|
2003-01-26 19:04:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<DeepSkyObject*> DeepSkyCatalog;
|
2003-03-24 01:55:54 -07:00
|
|
|
int LoadDeepSkyObjects(DeepSkyCatalog&, std::istream& in,
|
|
|
|
const std::string& path);
|
2003-01-26 19:04:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
#endif // _CELENGINE_DEEPSKYOBJ_H_
|