File indexing completed on 2024-04-21 03:51:23

0001 /*
0002     SPDX-FileCopyrightText: 2014 Inge Wallin <inge@lysator.liu.se>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 /** \file material.h
0008  *  \brief Material is what an object is made from. It has a color, density and some other physical properties.
0009  */
0010 
0011 #ifndef STEPCORE_MATERIAL_H
0012 #define STEPCORE_MATERIAL_H
0013 
0014 
0015 #include <vector> // XXX: Replace if Qt is enabled.
0016 
0017 #include <QString>
0018 
0019 #include "types.h"
0020 
0021 
0022 namespace StepCore
0023 {
0024 
0025 
0026 /** \ingroup materials
0027  *  \brief Interface for bodies
0028  *
0029  *  Material is anything that has dynamic variables that require ODE integration
0030  */
0031 class Material
0032 {
0033   //STEPCORE_OBJECT(Material)
0034 
0035 public:
0036     explicit Material(const QString& name = QString())
0037         : _name(name)
0038         , _color(0xff000000)
0039         , _density(1.0)
0040     {}
0041     virtual ~Material() {}
0042 
0043     Material &operator=(const Material &mtrl);
0044 
0045     /** Get the name of the material. */
0046     QString  name() const  { return _name; }
0047     /** Set the name of the material. */
0048     void setName(const QString &name)  { _name = name; }
0049 
0050     /** Get the color of the material. */
0051     Color  color() const  { return _color; }
0052     /** Set the color of the material. */
0053     void setColor(const Color &color)  { _color = color; }
0054 
0055     /** Get the density of the material. */
0056     double density() const  { return _density; }
0057     /** Set the density of the material. */
0058     void setDensity(const double density)  { _density = density; }
0059 
0060 
0061 private:
0062     QString  _name;
0063 
0064     Color    _color;
0065     double   _density;
0066     // ...more here?  Charge? other stuff?
0067 };
0068 
0069 
0070 /** List of pointers to Material */
0071 typedef std::vector<Material*>  MaterialList;
0072 
0073 extern Material GenericMaterial;
0074 
0075 
0076 } // namespace StepCore
0077 
0078 
0079 #endif