doesn't work
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Fri, 24 Feb 2017 09:52:47 +0000 (11:52 +0200)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Fri, 24 Feb 2017 09:52:47 +0000 (11:52 +0200)
src/exhibit.cc
src/exhibit.h

index 8653343..444fc40 100644 (file)
@@ -1,18 +1,43 @@
 #include "exhibit.h"
 #include "snode.h"
 
 #include "exhibit.h"
 #include "snode.h"
 
+class ExhibitPriv {
+       Vec3 orig_pos;
+       Quat orig_rot;
+       SceneNode *orig_node;
+};
+
+ExSelection::ExSelection(Exhibit *ex)
+{
+       this->ex = ex;
+       obj = data = 0;
+       validmask = 0;
+}
+
+ExSelection::operator bool() const
+{
+       return ex != 0;
+}
+
 Exhibit::Exhibit()
 {
 Exhibit::Exhibit()
 {
+       priv = new ExhibitPriv;
+       priv->orig_node = 0;
+}
+
+Exhibit::~Exhibit()
+{
+       delete priv;
 }
 
 }
 
-void *Exhibit::select(const Ray &ray) const
+ExSelection Exhibit::select(const Ray &ray) const
 {
 {
-       return 0;       // TODO
+       return ExSelection(0);
 }
 
 }
 
-void *Exhibit::select(const Sphere &sph) const
+ExSelection Exhibit::select(const Sphere &sph) const
 {
 {
-       return 0;       // TODO
+       return ExSelection(0);
 }
 
 void Exhibit::update(float dt)
 }
 
 void Exhibit::update(float dt)
index c4c0ec9..004626c 100644 (file)
@@ -5,22 +5,46 @@
 #include "object.h"
 #include "geom.h"
 
 #include "object.h"
 #include "geom.h"
 
-/*
+class Exhibit;
+class ExhibitPriv;
+
+enum {
+       EXSEL_RAY = 1,
+       EXSEL_SPHERE = 2
+};
+
+class ExSelection {
+public:
+       Exhibit *ex;
+       void *obj;
+       void *data;
+       Ray selray;
+       Sphere selsphere;
+       unsigned int validmask;
+
+       ExSelection(Exhibit *ex = 0);
+
+       operator bool() const;
+};
+
+/* TODO
 - select me aktina kai select me sfaira, epistrefei Selection
 - hover me aktina kai hover me sfaira
 - move me selection, origin, direction kai rotation (?)
  */
 - select me aktina kai select me sfaira, epistrefei Selection
 - hover me aktina kai hover me sfaira
 - move me selection, origin, direction kai rotation (?)
  */
-
 class Exhibit : public Object {
 class Exhibit : public Object {
+private:
+       ExhibitPriv *priv;
+
 public:
        Exhibit();
 public:
        Exhibit();
-       virtual ~Exhibit() = default;
+       virtual ~Exhibit();
 
        Exhibit(const Exhibit&) = delete;
        Exhibit &operator =(const Exhibit &) = delete;
 
 
        Exhibit(const Exhibit&) = delete;
        Exhibit &operator =(const Exhibit &) = delete;
 
-       virtual void *select(const Ray &ray) const;
-       virtual void *select(const Sphere &sph) const;
+       virtual ExSelection select(const Ray &ray) const;
+       virtual ExSelection select(const Sphere &sph) const;
 
        virtual void update(float dt = 0.0f);
 
 
        virtual void update(float dt = 0.0f);