World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Vis.h
См. документацию.
1 #pragma once
3 
8 };
9 
10 /* 150 */
11 #pragma pack(push, 1)
12 struct Vis_SelectionFilter { // stru157
14  int object_id; // OBJECT_Actor, OBJECT_Player etc
18 };
19 #pragma pack(pop)
20 extern Vis_SelectionFilter vis_sprite_filter_1; // 00F93E1C
21 extern Vis_SelectionFilter vis_sprite_filter_2; // 00F93E30
22 extern Vis_SelectionFilter vis_face_filter; // 00F93E44
23 extern Vis_SelectionFilter vis_door_filter; // 00F93E58
24 extern Vis_SelectionFilter vis_sprite_filter_3; // 00F93E6C
25 extern Vis_SelectionFilter vis_sprite_filter_4; // static to sub_44EEA7
26 
27 #pragma pack(push, 1)
29  void *object;
30  union {
31  // int sZValue;
32  struct {
35  };
36  };
38 };
39 #pragma pack(pop)
40 
41 #pragma pack(push, 1)
43  enum PointerCreationType { All = 0, Unique = 1 };
44 
46  //----- (004C0585) --------------------------------------------------------
48  Vis_ObjectInfo *SelectionPointers(int a2, int a3);
50 
51  inline void AddObject(void *object, VisObjectType type, int depth,
52  int pid) {
57  uNumPointers++;
58  }
59 
63  unsigned int uNumPointers;
64 };
65 #pragma pack(pop)
66 
67 /* 116 */
68 #pragma pack(push, 1)
69 class Vis {
70  public:
71  Vis();
72  //----- (004C05A2) --------------------------------------------------------
73  // virtual ~Vis() {}
74  //----- (004C05BE) --------------------------------------------------------
75  virtual ~Vis() {}
77  Vis_SelectionFilter *sprite_filter,
78  Vis_SelectionFilter *face_filter);
79  void PickBillboards_Keyboard(float pick_depth, Vis_SelectionList *list,
81  void PickIndoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list,
83  void PickOutdoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list,
85 
86  bool PickMouse(float fDepth, float fMouseX, float fMouseY,
87  Vis_SelectionFilter *sprite_filter,
88  Vis_SelectionFilter *face_filter);
89  void PickBillboards_Mouse(float fPickDepth, float fX, float fY,
90  Vis_SelectionList *list,
92  void PickIndoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay,
93  Vis_SelectionList *list,
95  void PickOutdoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay,
96  Vis_SelectionList *list,
98  bool only_reachable);
99 
100  bool is_part_of_selection(void *uD3DBillboardIdx_or_pBLVFace_or_pODMFace,
102  bool DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx);
104  unsigned int a3,
105  float pick_depth);
106  bool IsPolygonOccludedByBillboard(struct RenderVertexSoft *vertices,
107  int num_vertices, float x, float y);
109  unsigned int uNumVertices, float *pCenterX,
110  float *pCenterY);
111  void GetPolygonScreenSpaceCenter(struct RenderVertexSoft *vertices,
112  int num_vertices, float *out_center_x,
113  float *out_center_y);
114  bool IsPointInsideD3DBillboard(struct RenderBillboardD3D *a1, float x,
115  float y);
116  unsigned short PickClosestActor(int object_id, unsigned int pick_depth,
117  int a4, int a5, int a6);
118  void _4C1A02();
119  void SortVectors_x(RenderVertexSoft *pArray, int start, int end);
122  bool Intersect_Ray_Face(struct RenderVertexSoft *pRayStart,
123  struct RenderVertexSoft *pRayEnd, float *pDepth,
124  RenderVertexSoft *Intersection, BLVFace *pFace,
125  signed int pBModelID);
126  bool CheckIntersectBModel(BLVFace *pFace, Vec3_short_ IntersectPoint,
127  signed int sModelID);
131  Vec3_short_ *IntersectPoint, BLVFace *pFace);
135  Vec3_short_ *IntersectPoint, BLVFace *pFace, unsigned int uModelID);
136  void CastPickRay(RenderVertexSoft *pRay, float fMouseX, float fMouseY,
137  float fPickDepth);
138  void sort_object_pointers(Vis_ObjectInfo **pPointers, int start, int end);
139  void SortVerticesByX(struct RenderVertexD3D3 *pArray, unsigned int uStart,
140  unsigned int uEnd);
141  void SortVerticesByY(struct RenderVertexD3D3 *pArray, unsigned int uStart,
142  unsigned int uEnd);
143  void SortByScreenSpaceX(struct RenderVertexSoft *pArray, int start,
144  int end);
145  void SortByScreenSpaceY(struct RenderVertexSoft *pArray, int start,
146  int end);
147 
148  // void ( ***vdestructor_ptr)(Vis *, bool);
155 
156  Log *log = nullptr;
157 };
158 #pragma pack(pop)
Vis::IsPolygonOccludedByBillboard
bool IsPolygonOccludedByBillboard(struct RenderVertexSoft *vertices, int num_vertices, float x, float y)
Definition: Vis.cpp:132
Vis_SelectionList::SelectionPointers
Vis_ObjectInfo * SelectionPointers(int a2, int a3)
Definition: Vis.cpp:956
uint16_t
unsigned __int16 uint16_t
Definition: SDL_config.h:37
face
GLenum GLuint GLint GLenum face
Definition: SDL_opengl_glext.h:3022
Vis::PickIndoorFaces_Mouse
void PickIndoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter)
Definition: Vis.cpp:305
Vis::SortByScreenSpaceX
void SortByScreenSpaceX(struct RenderVertexSoft *pArray, int start, int end)
Definition: Vis.cpp:1128
int16_t
signed __int16 int16_t
Definition: SDL_config.h:36
Vis::IsPointInsideD3DBillboard
bool IsPointInsideD3DBillboard(struct RenderBillboardD3D *a1, float x, float y)
Definition: Vis.cpp:251
Vis_SelectionFilter::no_at_ai_state
int no_at_ai_state
Definition: Vis.h:16
Vis::log
Log * log
Definition: Vis.h:156
Vis::is_part_of_selection
bool is_part_of_selection(void *uD3DBillboardIdx_or_pBLVFace_or_pODMFace, Vis_SelectionFilter *filter)
Definition: Vis.cpp:1324
Vis::stru_200C
RenderVertexSoft stru_200C
Definition: Vis.h:150
end
GLuint GLuint end
Definition: SDL_opengl.h:1571
Vis_ObjectInfo::object_pid
uint16_t object_pid
Definition: Vis.h:33
Vis::CheckIntersectBModel
bool CheckIntersectBModel(BLVFace *pFace, Vec3_short_ IntersectPoint, signed int sModelID)
Definition: Vis.cpp:585
Vis_SelectionList::AddObject
void AddObject(void *object, VisObjectType type, int depth, int pid)
Definition: Vis.h:51
RenderBillboardD3D
Definition: IRender.h:138
Vis::CastPickRay
void CastPickRay(RenderVertexSoft *pRay, float fMouseX, float fMouseY, float fPickDepth)
Definition: Vis.cpp:921
Vis_SelectionList::object_pool
Vis_ObjectInfo object_pool[512]
Definition: Vis.h:61
Vis_SelectionList::~Vis_SelectionList
~Vis_SelectionList()
Definition: Vis.h:47
RenderVertexD3D3
Definition: IRender.h:129
Vis::get_object_zbuf_val
int get_object_zbuf_val(Vis_ObjectInfo *info)
Definition: Vis.cpp:494
Vis::~Vis
virtual ~Vis()
Definition: Vis.h:75
vis_face_filter
Vis_SelectionFilter vis_face_filter
Definition: Vis.cpp:26
Log
Definition: Log.h:3
VisObjectType_Any
@ VisObjectType_Any
Definition: Vis.h:5
vis_sprite_filter_4
Vis_SelectionFilter vis_sprite_filter_4
Definition: Vis.cpp:32
Vis_SelectionFilter::at_ai_state
int at_ai_state
Definition: Vis.h:15
Vis::get_picked_object_zbuf_val
int get_picked_object_zbuf_val()
Definition: Vis.cpp:517
Vis::GetPolygonCenter
void GetPolygonCenter(struct RenderVertexD3D3 *pVertices, unsigned int uNumVertices, float *pCenterX, float *pCenterY)
Definition: Vis.cpp:185
VisObjectType
VisObjectType
Definition: Vis.h:4
vis_sprite_filter_2
Vis_SelectionFilter vis_sprite_filter_2
Definition: Vis.cpp:24
Vis::DoesRayIntersectBillboard
bool DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx)
Definition: Vis.cpp:1418
Vis::SortVerticesByY
void SortVerticesByY(struct RenderVertexD3D3 *pArray, unsigned int uStart, unsigned int uEnd)
Definition: Vis.cpp:1092
Vis::DetermineFacetIntersection
Vis_ObjectInfo * DetermineFacetIntersection(struct BLVFace *face, unsigned int a3, float pick_depth)
Definition: Vis.cpp:36
Vis_SelectionList::All
@ All
Definition: Vis.h:43
filter
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: SDL_opengl_glext.h:1187
Vis_ObjectInfo::object
void * object
Definition: Vis.h:29
Vis::GetPolygonScreenSpaceCenter
void GetPolygonScreenSpaceCenter(struct RenderVertexSoft *vertices, int num_vertices, float *out_center_x, float *out_center_y)
Definition: Vis.cpp:204
pVertices
struct RenderVertexD3D3 pVertices[50]
Definition: Render.cpp:50
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
vis_sprite_filter_1
Vis_SelectionFilter vis_sprite_filter_1
Definition: Vis.cpp:22
intersect_face_vertex_coords_list_a
std::array< int16_t, 104 > intersect_face_vertex_coords_list_a
Definition: mm7_data.cpp:786
object
GLuint object
Definition: SDL_opengl_glext.h:6060
IRender.h
Vis::SortByScreenSpaceY
void SortByScreenSpaceY(struct RenderVertexSoft *pArray, int start, int end)
Definition: Vis.cpp:1166
Vis
Definition: Vis.h:69
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
Vis_SelectionFilter
Definition: Vis.h:12
Vis_SelectionList::Unique
@ Unique
Definition: Vis.h:43
BLVFace
Definition: Indoor.h:424
VisObjectType_Sprite
@ VisObjectType_Sprite
Definition: Vis.h:6
Vis::PickIndoorFaces_Keyboard
void PickIndoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter)
Definition: Vis.cpp:1571
Vis::_4C1A02
void _4C1A02()
Definition: Vis.cpp:427
Vis_SelectionList::PointerCreationType
PointerCreationType
Definition: Vis.h:43
Vis::Intersect_Ray_Face
bool Intersect_Ray_Face(struct RenderVertexSoft *pRayStart, struct RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *Intersection, BLVFace *pFace, signed int pBModelID)
Definition: Vis.cpp:524
Vis::stru_206C
RenderVertexSoft stru_206C
Definition: Vis.h:152
type
EGLenum type
Definition: SDL_egl.h:850
Vis::PickOutdoorFaces_Keyboard
void PickOutdoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter)
Definition: Vis.cpp:1601
Vis::PickBillboards_Keyboard
void PickBillboards_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter)
Definition: Vis.cpp:1303
Vis::SortVerticesByX
void SortVerticesByX(struct RenderVertexD3D3 *pArray, unsigned int uStart, unsigned int uEnd)
Definition: Vis.cpp:1056
Vis::stru_203C
RenderVertexSoft stru_203C
Definition: Vis.h:151
Vis_ObjectInfo
Definition: Vis.h:28
Vis_SelectionList::Vis_SelectionList
Vis_SelectionList()
Definition: Vis.cpp:1236
depth
GLint GLint GLsizei GLsizei GLsizei depth
Definition: SDL_opengl.h:1572
start
GLuint start
Definition: SDL_opengl.h:1571
vis_door_filter
Vis_SelectionFilter vis_door_filter
Definition: Vis.cpp:28
Vis_SelectionFilter::object_id
int object_id
Definition: Vis.h:14
Vis::SortVectors_x
void SortVectors_x(RenderVertexSoft *pArray, int start, int end)
Definition: Vis.cpp:458
void
typedef void(SDLCALL *SDL_AudioFilter)(struct SDL_AudioCVT *cvt
VisObjectType_Face
@ VisObjectType_Face
Definition: Vis.h:7
vis_sprite_filter_3
Vis_SelectionFilter vis_sprite_filter_3
Definition: Vis.cpp:30
Vis::PickClosestActor
unsigned short PickClosestActor(int object_id, unsigned int pick_depth, int a4, int a5, int a6)
Definition: Vis.cpp:403
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
Vis::BLV_CreateIntersectFacesVertexCoordList
void BLV_CreateIntersectFacesVertexCoordList(int *a, int *b, int16_t *intersect_face_vertex_coords_list_a, int16_t *intersect_face_vertex_coords_list_b, Vec3_short_ *IntersectPoint, BLVFace *pFace)
Definition: Vis.cpp:731
Vis::PickOutdoorFaces_Mouse
void PickOutdoorFaces_Mouse(float fDepth, struct RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter, bool only_reachable)
Definition: Vis.cpp:359
Vis_SelectionList::create_object_pointers
void create_object_pointers(PointerCreationType type=All)
Definition: Vis.cpp:975
Vis::PickMouse
bool PickMouse(float fDepth, float fMouseX, float fMouseY, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter)
Definition: Vis.cpp:1268
Vis_SelectionFilter::object_type
VisObjectType object_type
Definition: Vis.h:13
Vis::keyboard_pick_depth
int keyboard_pick_depth
Definition: Vis.h:154
Vis_SelectionFilter::select_flags
int select_flags
Definition: Vis.h:17
Vis::PickKeyboard
bool PickKeyboard(Vis_SelectionList *list, Vis_SelectionFilter *sprite_filter, Vis_SelectionFilter *face_filter)
Definition: Vis.cpp:1247
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
Vis_ObjectInfo::depth
int16_t depth
Definition: Vis.h:34
Vis::PickBillboards_Mouse
void PickBillboards_Mouse(float fPickDepth, float fX, float fY, Vis_SelectionList *list, Vis_SelectionFilter *filter)
Definition: Vis.cpp:231
Vis_SelectionList::uNumPointers
unsigned int uNumPointers
Definition: Vis.h:63
RenderVertexSoft
Definition: IRender.h:113
Vis::Vis
Vis()
Definition: Vis.cpp:1202
Vis_ObjectInfo::object_type
VisObjectType object_type
Definition: Vis.h:37
Vis_SelectionList
Definition: Vis.h:42
Vis_SelectionList::vdestructor_ptr
void(*** vdestructor_ptr)(Vis_SelectionList *, bool)
Definition: Vis.h:60
uint32_t
unsigned __int32 uint32_t
Definition: SDL_config.h:39
Vis::stru_209C
RenderVertexSoft stru_209C
Definition: Vis.h:153
Vis::sort_object_pointers
void sort_object_pointers(Vis_ObjectInfo **pPointers, int start, int end)
Definition: Vis.cpp:1008
Vis_SelectionList::object_pointers
Vis_ObjectInfo * object_pointers[512]
Definition: Vis.h:62
Vis::ODM_CreateIntersectFacesVertexCoordList
void ODM_CreateIntersectFacesVertexCoordList(int *a, int *b, int16_t *intersect_face_vertex_coords_list_a, int16_t *intersect_face_vertex_coords_list_b, Vec3_short_ *IntersectPoint, BLVFace *pFace, unsigned int uModelID)
Definition: Vis.cpp:798
intersect_face_vertex_coords_list_b
std::array< int16_t, 104 > intersect_face_vertex_coords_list_b
Definition: mm7_data.cpp:787
Vis::default_list
Vis_SelectionList default_list
Definition: Vis.h:149