-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPolychora.h
More file actions
124 lines (86 loc) · 2.56 KB
/
Polychora.h
File metadata and controls
124 lines (86 loc) · 2.56 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#pragma once
//#include <d3d10.h>
#include <d3dx10.h>
#include "Viewpoint.h"
#include <vector>
#include <unordered_map>
#include <set>
#include <string>
#include <map>
#include <functional>
#include <string>
//--------------------------------------------------------------------------------------
// Structures
//--------------------------------------------------------------------------------------
struct Vertex4D
{
Vertex4D(D3DXVECTOR4 vecPos,D3DXVECTOR4 vecNorm) : Pos(vecPos), Norm(vecNorm){}
Vertex4D(D3DXVECTOR4 vecPos) : Pos(vecPos), Norm(D3DXVECTOR4()){}
D3DXVECTOR4 Pos;
D3DXVECTOR4 Norm;
};
//////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////
class CEdge
{
public:
CEdge(const int & idxFrom, const int & idxTo) : from(idxFrom), to(idxTo) { }
public:
int from;
int to;
CEdge & operator= (const CEdge & other)
{
from = other.from;
to = other.to;
return *this;
}
};
//////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////
class CFace
{
public:
CFace(CEdge * edgeA,CEdge * edgeB): a(edgeA), b(edgeB){}
public:
const CEdge * a;
const CEdge * b;
};
class CPolychora{
public:
CPolychora(void);
~CPolychora(void);
public:
std::vector<D3DXVECTOR4> vertices;
std::vector<CEdge> edges;
std::vector<CFace> faces;
std::unordered_map<int, std::vector<int>> tails;
std::unordered_map<int, std::vector<int>> heads;
void CreateVertexBuffers(ID3D10Effect * fx, ID3D10Device * device);
void CreateInputLayout( ID3D10Effect * fx, ID3D10Device * device );
void Render( ID3D10Effect * fx, ID3D10Device * device ,CViewpoint * viewpoint);
void SoftwareProjectLines(ID3D10EffectTechnique * tech, ID3D10Device * device,CViewpoint * viewpoint);
void Release();
static CPolychora * Tesseract();
static CPolychora * SixteenCell();
static CPolychora * Pentatope();
static CPolychora * Icositetrachoron_24cell();
static CPolychora * Line();
static CPolychora * Plane();
float vFlareSpecularAmp;
float vFaceSpecularAmp;
float vFaceEnviAmp;
static std::map<std::wstring, std::function<CPolychora *(void)> > PolychoraGenerators;
std::wstring Name;
private:
ID3D10InputLayout* vertexLayout;
ID3D10Buffer * linesVtxBuf;
ID3D10Buffer * linesIdxBuf;
ID3D10Buffer * facesIdxBuf;
D3DXVECTOR4 vFlareSpecularColor;
D3DXVECTOR3 vFaceEnviColor;
D3DXVECTOR4 vFaceSpecularColor;
void AddEdge(const int & idx1, const int & idx2);
void CreateEdgesWithLength(float len);
};