leocad/common/lc_viewsphere.h

55 lines
1.1 KiB
C
Raw Normal View History

2018-08-19 20:27:58 -07:00
#pragma once
#include "lc_math.h"
#include "lc_context.h"
2018-08-19 20:27:58 -07:00
#include <bitset>
2020-12-05 10:29:39 -08:00
enum class lcViewSphereLocation
{
TopLeft,
TopRight,
BottomLeft,
BottomRight
};
2018-10-28 17:59:01 -07:00
class lcViewSphere
2018-08-19 20:27:58 -07:00
{
public:
2020-12-25 10:54:33 -08:00
lcViewSphere(lcView* View);
2018-08-19 20:27:58 -07:00
void Draw();
bool OnMouseMove();
bool OnLeftButtonUp();
bool OnLeftButtonDown();
bool IsDragging() const;
2018-08-19 20:27:58 -07:00
static void CreateResources(lcContext* Context);
static void DestroyResources(lcContext* Context);
2018-10-28 17:59:01 -07:00
2018-08-19 20:27:58 -07:00
protected:
2020-12-05 10:29:39 -08:00
void UpdateSettings();
2018-08-19 20:27:58 -07:00
lcMatrix44 GetViewMatrix() const;
lcMatrix44 GetProjectionMatrix() const;
std::bitset<6> GetIntersectionFlags(lcVector3& Intersection) const;
2018-08-19 20:27:58 -07:00
2020-12-25 10:54:33 -08:00
lcView* const mView = nullptr;
2020-12-05 10:29:39 -08:00
int mSize = 1;
bool mEnabled = false;
2020-12-05 10:29:39 -08:00
lcViewSphereLocation mLocation = lcViewSphereLocation::TopRight;
2020-12-05 08:45:29 -08:00
int mMouseDownX = 0;
int mMouseDownY = 0;
bool mMouseDown = false;
2020-12-05 10:29:39 -08:00
lcVector3 mIntersection;
std::bitset<6> mIntersectionFlags;
2018-10-28 17:59:01 -07:00
static lcTexture* mTexture;
static lcVertexBuffer mVertexBuffer;
static lcIndexBuffer mIndexBuffer;
static const float mRadius;
2019-01-19 20:04:08 -08:00
static const float mHighlightRadius;
static const int mSubdivisions;
2018-08-19 20:27:58 -07:00
};