Lightmetrica  0.0.1.50dbee3 (yosakoi)
 All Classes Functions Variables Typedefs Enumerations Enumerator
surfacegeometry.h
1 /*
2  Lightmetrica : A research-oriented renderer
3 
4  Copyright (c) 2014 Hisanari Otsu
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 #ifndef __LIB_LIGHTMETICA_SURFACE_GEOMETRY_H__
22 #define __LIB_LIGHTMETICA_SURFACE_GEOMETRY_H__
23 
24 #include "common.h"
25 #include "math.types.h"
26 #include "math.linalgebra.h"
27 
28 LM_NAMESPACE_BEGIN
29 
37 {
38 
39  bool degenerated;
40 
41  Math::Vec3 p;
42  Math::Vec3 gn;
43  Math::Vec3 sn;
44  Math::Vec3 ss, st;
45  Math::Vec2 uv;
46 
47  Math::Mat3 worldToShading;
48  Math::Mat3 shadingToWorld;
49 
54  LM_FORCE_INLINE void ComputeTangentSpace()
55  {
56  // Tangent vectors
57  Math::OrthonormalBasis(sn, ss, st);
58 
59  // Shading coordinates conversion
60  shadingToWorld = Math::Mat3(ss, st, sn);
61  worldToShading = Math::Transpose(shadingToWorld);
62  }
63 
64 };
65 
66 LM_NAMESPACE_END
67 
68 #endif // __LIB_LIGHTMETICA_SURFACE_GEOMETRY_H__
Math::Vec3 p
Intersection point.
Definition: surfacegeometry.h:41
Math::Mat3 shadingToWorld
Convarsion to world coordinates from local shading coordinates.
Definition: surfacegeometry.h:48
LM_FORCE_INLINE void ComputeTangentSpace()
Definition: surfacegeometry.h:54
Math::Vec3 st
Tangent vectors w.r.t. shading normal.
Definition: surfacegeometry.h:44
Math::Vec3 gn
Geometry normal.
Definition: surfacegeometry.h:42
Definition: surfacegeometry.h:36
bool degenerated
The surface geometry is positionally degenerated if true.
Definition: surfacegeometry.h:39
Math::Vec2 uv
Texture coordinates.
Definition: surfacegeometry.h:45
Math::Mat3 worldToShading
Convarsion to local shading coordinates from world coordinates.
Definition: surfacegeometry.h:47
Math::Vec3 sn
Shading normal.
Definition: surfacegeometry.h:43