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