Duckcpp 2.1.0
Duckcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
IMeshLoader.hpp
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in duckcpp/duckcpp.hpp
4
5#ifndef DCPP_I_MESH_LOADER_HPP_INCLUDED
6#define DCPP_I_MESH_LOADER_HPP_INCLUDED
7
8#include <duckcpp/core/engine/IReferenceCounted.hpp>
9#include <duckcpp/core/engine/path.hpp>
10#include <duckcpp/core/engine/IMeshTextureLoader.hpp>
11#include <duckcpp/core/engine/SVertexIndex.hpp>
12
13namespace dcpp
14{
15namespace io
16{
17 class IReadFile;
18} // end namespace io
19namespace scene
20{
21 class IAnimatedMesh;
22
24
28class IMeshLoader : public virtual IReferenceCounted
29{
30public:
31
33 IMeshLoader() : TextureLoader(0), IndexTypeHint(EITH_OPTIMAL) {}
34
36 virtual ~IMeshLoader()
37 {
38 if ( TextureLoader )
39 TextureLoader->drop();
40 }
41
43
47 virtual bool isALoadableFileExtension(const dcpp::io::path& filename) const = 0;
48
50
55
57
62 virtual void setMeshTextureLoader(IMeshTextureLoader* textureLoader)
63 {
64 if ( textureLoader != TextureLoader )
65 {
66 if ( textureLoader )
67 textureLoader->grab();
68 if ( TextureLoader )
69 TextureLoader->drop();
70 TextureLoader = textureLoader;
71 }
72 }
73
75
78 {
79 return TextureLoader;
80 }
81
97
98
100
108 {
109 IndexTypeHint = typeHint;
110 }
111
113
115 {
116 return IndexTypeHint;
117 }
118
119
120protected:
121 IMeshTextureLoader* TextureLoader;
122 E_INDEX_TYPE_HINT IndexTypeHint;
123};
124
125
126} // end namespace scene
127} // end namespace dcpp
128
129#endif
Base class of most objects of the Duckcpp Engine.
Definition IReferenceCounted.hpp:46
bool drop() const
Drops the object. Decrements the reference counter by one.
Definition IReferenceCounted.hpp:126
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.hpp:96
Interface providing read access to a file.
Definition IReadFile.hpp:19
Interface for an animated mesh.
Definition IAnimatedMesh.hpp:21
Class which is able to load an animated mesh from a file.
Definition IMeshLoader.hpp:29
virtual void setMeshTextureLoader(IMeshTextureLoader *textureLoader)
Set a new texture loader which this meshloader can use when searching for textures.
Definition IMeshLoader.hpp:62
E_INDEX_TYPE_HINT
Definition IMeshLoader.hpp:83
@ EITH_16BIT
Definition IMeshLoader.hpp:86
@ EITH_OPTIMAL
Definition IMeshLoader.hpp:95
@ EITH_32BIT
Allow using 32-bit index buffers.
Definition IMeshLoader.hpp:89
IMeshLoader()
Constructor.
Definition IMeshLoader.hpp:33
void setIndexTypeHint(E_INDEX_TYPE_HINT typeHint)
Give loader a hint if you would prefer 16 or 32 bit meshbuffers.
Definition IMeshLoader.hpp:107
virtual IAnimatedMesh * createMesh(dcpp::io::IReadFile *file)=0
Creates/loads an animated mesh from the file.
virtual IMeshTextureLoader * getMeshTextureLoader() const
Get the texture loader used when this meshloader searches for textures.
Definition IMeshLoader.hpp:77
virtual bool isALoadableFileExtension(const dcpp::io::path &filename) const =0
Returns true if the file might be loaded by this class.
E_INDEX_TYPE_HINT getIndexTypeHint() const
Return current preference user has for the index type of meshbuffers.
Definition IMeshLoader.hpp:114
virtual ~IMeshLoader()
Destructor.
Definition IMeshLoader.hpp:36
Finding and loading textures inside meshloaders.
Definition IMeshTextureLoader.hpp:31
As of Duckcpp 1.6, position2d is a synonym for vector2d.
Definition shared_device.hpp:34

Duckcpp    @cppfx.xyz