TrinityCore
Loading...
Searching...
No Matches
ModelInstance.h
Go to the documentation of this file.
1
/*
2
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef _MODELINSTANCE_H_
19
#define _MODELINSTANCE_H_
20
21
#include <G3D/Matrix3.h>
22
#include <G3D/Vector3.h>
23
#include <G3D/AABox.h>
24
#include <G3D/Ray.h>
25
26
#include "
Define.h
"
27
28
namespace
VMAP
29
{
30
class
WorldModel;
31
struct
AreaInfo;
32
struct
LocationInfo;
33
enum class
ModelIgnoreFlags
:
uint32
;
34
35
enum
ModelFlags
36
{
37
MOD_M2
= 1,
38
MOD_WORLDSPAWN
= 1<<1,
39
MOD_HAS_BOUND
= 1<<2
40
};
41
42
class
TC_COMMON_API
ModelSpawn
43
{
44
public
:
45
//mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name
46
uint32
flags
;
47
uint16
adtId
;
48
uint32
ID
;
49
G3D::Vector3
iPos
;
50
G3D::Vector3
iRot
;
51
float
iScale
;
52
G3D::AABox
iBound
;
53
std::string
name
;
54
bool
operator==
(
ModelSpawn
const
& other)
const
{
return
ID == other.
ID
; }
55
//uint32 hashCode() const { return ID; }
56
// temp?
57
const
G3D::AABox&
getBounds
()
const
{
return
iBound; }
58
59
static
bool
readFromFile(FILE* rf,
ModelSpawn
&spawn);
60
static
bool
writeToFile(FILE* rw,
ModelSpawn
const
& spawn);
61
};
62
63
class
TC_COMMON_API
ModelInstance
:
public
ModelSpawn
64
{
65
public
:
66
ModelInstance
(): iInvScale(0.0f), iModel(nullptr) { }
67
ModelInstance
(
ModelSpawn
const
& spawn,
WorldModel
* model);
68
void
setUnloaded
() { iModel =
nullptr
; }
69
bool
intersectRay(G3D::Ray
const
& pRay,
float
& pMaxDist,
bool
pStopAtFirstHit,
ModelIgnoreFlags
ignoreFlags)
const
;
70
bool
GetLocationInfo(G3D::Vector3
const
& p,
LocationInfo
&info)
const
;
71
bool
GetLiquidLevel(G3D::Vector3
const
& p,
LocationInfo
&info,
float
&liqHeight)
const
;
72
WorldModel
*
getWorldModel
() {
return
iModel; }
73
protected
:
74
G3D::Matrix3
iInvRot
;
75
float
iInvScale
;
76
WorldModel
*
iModel
;
77
};
78
}
// namespace VMAP
79
80
#endif
// _MODELINSTANCE
Define.h
TC_COMMON_API
#define TC_COMMON_API
Definition
Define.h:96
uint16
uint16_t uint16
Definition
Define.h:134
uint32
uint32_t uint32
Definition
Define.h:133
VMAP::ModelInstance
Definition
ModelInstance.h:64
VMAP::ModelInstance::setUnloaded
void setUnloaded()
Definition
ModelInstance.h:68
VMAP::ModelInstance::getWorldModel
WorldModel * getWorldModel()
Definition
ModelInstance.h:72
VMAP::ModelInstance::ModelInstance
ModelInstance()
Definition
ModelInstance.h:66
VMAP::ModelInstance::iInvRot
G3D::Matrix3 iInvRot
Definition
ModelInstance.h:74
VMAP::ModelInstance::iModel
WorldModel * iModel
Definition
ModelInstance.h:76
VMAP::ModelInstance::iInvScale
float iInvScale
Definition
ModelInstance.h:75
VMAP::ModelSpawn
Definition
ModelInstance.h:43
VMAP::ModelSpawn::adtId
uint16 adtId
Definition
ModelInstance.h:47
VMAP::ModelSpawn::name
std::string name
Definition
ModelInstance.h:53
VMAP::ModelSpawn::iRot
G3D::Vector3 iRot
Definition
ModelInstance.h:50
VMAP::ModelSpawn::operator==
bool operator==(ModelSpawn const &other) const
Definition
ModelInstance.h:54
VMAP::ModelSpawn::iScale
float iScale
Definition
ModelInstance.h:51
VMAP::ModelSpawn::ID
uint32 ID
Definition
ModelInstance.h:48
VMAP::ModelSpawn::iPos
G3D::Vector3 iPos
Definition
ModelInstance.h:49
VMAP::ModelSpawn::flags
uint32 flags
Definition
ModelInstance.h:46
VMAP::ModelSpawn::iBound
G3D::AABox iBound
Definition
ModelInstance.h:52
VMAP::ModelSpawn::getBounds
const G3D::AABox & getBounds() const
Definition
ModelInstance.h:57
VMAP::WorldModel
Definition
WorldModel.h:110
VMAP
Definition
DynamicTree.h:34
VMAP::ModelIgnoreFlags
ModelIgnoreFlags
Definition
ModelIgnoreFlags.h:26
VMAP::ModelFlags
ModelFlags
Definition
ModelInstance.h:36
VMAP::MOD_WORLDSPAWN
@ MOD_WORLDSPAWN
Definition
ModelInstance.h:38
VMAP::MOD_HAS_BOUND
@ MOD_HAS_BOUND
Definition
ModelInstance.h:39
VMAP::MOD_M2
@ MOD_M2
Definition
ModelInstance.h:37
VMAP::LocationInfo
Definition
MapTree.h:40
common
Collision
Models
ModelInstance.h
Generated on Sun May 10 2026 02:30:12 for TrinityCore by
1.9.8