GlistEngine
Loading...
Searching...
No Matches
gRay.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Nitra Games Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef GRAPHICS_GRAY_H_
18#define GRAPHICS_GRAY_H_
19
20#include "gRenderObject.h"
21
22#define GLM_ENABLE_EXPERIMENTAL
23#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES
24#include <glm/glm.hpp>
25#include <glm/gtc/matrix_transform.hpp>
26#include <glm/gtx/quaternion.hpp>
27
28class gMesh;
29class gBoundingBox;
30
31
32class gRay : public gRenderObject {
33public:
35 gRay(const glm::vec3& originPoint, const glm::vec3& directionVector);
36 virtual ~gRay();
37
38 void setOrigin(const glm::vec3& originPoint);
39 void setDirection(const glm::vec3& directionVector);
40 const glm::vec3& getOrigin();
41 const glm::vec3 getDirection();
42 float getLength() const;
43
44 bool intersects(gBoundingBox& boundingBox);
45 float distance(gBoundingBox& boundingBox);
46
47 void link(gMesh* mesh, float rayScale = 1.0f, bool isNormalized = false, float dx = 0.0f, float dy = 0.0f, float dz = 0.0f);
48 void unlink();
49
50 void draw();
51
52private:
53 glm::vec3 origin, direction;
54 bool islinked;
55 gMesh* linkedmesh;
56 float scale;
57 bool isnormalized;
58 glm::vec3 pdiff;
59 float length;
60 glm::vec3 originpoint, directionpoint;
61 glm::vec3 linkedmeshpos;
62 glm::mat4 linkedmeshorientation;
63};
64
65#endif /* GRAPHICS_GRAY_H_ */
Definition gBoundingBox.h:36
Definition gMesh.h:27
Definition gRay.h:32
void setDirection(const glm::vec3 &directionVector)
float getLength() const
const glm::vec3 getDirection()
float distance(gBoundingBox &boundingBox)
void setOrigin(const glm::vec3 &originPoint)
virtual ~gRay()
const glm::vec3 & getOrigin()
void unlink()
bool intersects(gBoundingBox &boundingBox)
void draw()
void link(gMesh *mesh, float rayScale=1.0f, bool isNormalized=false, float dx=0.0f, float dy=0.0f, float dz=0.0f)
gRay(const glm::vec3 &originPoint, const glm::vec3 &directionVector)
Definition gRenderObject.h:25