-
Notifications
You must be signed in to change notification settings - Fork 215
/
Cylinder.h
64 lines (53 loc) · 2.67 KB
/
Cylinder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef VRBROWSER_CYLINDER_DOT_H
#define VRBROWSER_CYLINDER_DOT_H
#include "vrb/Forward.h"
#include "vrb/MacroUtils.h"
#include "Device.h"
#include <memory>
#include <string>
#include <vector>
#include <functional>
namespace crow {
class VRLayerCylinder;
typedef std::shared_ptr<VRLayerCylinder> VRLayerCylinderPtr;
class Cylinder;
typedef std::shared_ptr<Cylinder> CylinderPtr;
class Cylinder {
public:
static CylinderPtr Create(vrb::CreationContextPtr aContext, const float aRadius, const float aHeight, const VRLayerCylinderPtr& aLayer = nullptr);
static CylinderPtr Create(vrb::CreationContextPtr aContext, const float aRadius, const float aHeight, const vrb::Color& aSolidColor, const float kBorder, const vrb::Color& aBorderColor);
static CylinderPtr Create(vrb::CreationContextPtr aContext, const VRLayerCylinderPtr& aLayer = nullptr);
void GetTextureSize(int32_t& aWidth, int32_t& aHeight) const;
void SetTextureSize(int32_t aWidth, int32_t aHeight);
void SetTexture(const vrb::TexturePtr& aTexture, int32_t aWidth, int32_t aHeight);
void SetTextureScale(const float aScaleX, const float aScaleY);
void SetMaterial(const vrb::Color& aAmbient, const vrb::Color& aDiffuse, const vrb::Color& aSpecular, const float aSpecularExponent);
void SetLightsEnabled(const bool aEnabled);
float GetCylinderRadius() const;
float GetCylinderHeight() const;
float GetCylinderTheta() const;
vrb::RenderStatePtr GetRenderState() const;
void SetCylinderTheta(const float aAngleLength);
void SetTintColor(const vrb::Color& aColor);
vrb::NodePtr GetRoot() const;
VRLayerCylinderPtr GetLayer() const;
vrb::TransformPtr GetTransformNode() const;
void SetTransform(const vrb::Matrix& aTransform);
bool TestIntersection(const vrb::Vector& aStartPoint, const vrb::Vector& aDirection, vrb::Vector& aResult, vrb::Vector& aNormal, bool aClamp, bool& aIsInside, float& aDistance) const;
void ConvertToQuadCoordinates(const vrb::Vector& point, float& aX, float& aY, bool aClamp) const;
void ConvertFromQuadCoordinates(const float aX, const float aY, vrb::Vector& aWorldPoint, vrb::Vector& aNormal);
float DistanceToBackPlane(const vrb::Vector& aStartPoint, const vrb::Vector& aDirection) const;
struct State;
Cylinder(State& aState, vrb::CreationContextPtr& aContext);
~Cylinder();
private:
State& m;
Cylinder() = delete;
VRB_NO_DEFAULTS(Cylinder)
};
} // namespace crow
#endif // VRBROWSER_CYLINDER_DOT_H