1/*
2Open Asset Import Library (assimp)
3----------------------------------------------------------------------
4
5Copyright (c) 2006-2017, assimp team
6
7All rights reserved.
8
9Redistribution and use of this software in source and binary forms,
10with or without modification, are permitted provided that the
11following conditions are met:
12
13* Redistributions of source code must retain the above
14 copyright notice, this list of conditions and the
15 following disclaimer.
16
17* Redistributions in binary form must reproduce the above
18 copyright notice, this list of conditions and the
19 following disclaimer in the documentation and/or other
20 materials provided with the distribution.
21
22* Neither the name of the assimp team, nor the names of its
23 contributors may be used to endorse or promote products
24 derived from this software without specific prior
25 written permission of the assimp team.
26
27THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
39----------------------------------------------------------------------
40*/
41
42/** @file BlenderModifier.h
43 * @brief Declare dedicated helper classes to simulate some blender modifiers (i.e. mirror)
44 */
45#ifndef INCLUDED_AI_BLEND_MODIFIER_H
46#define INCLUDED_AI_BLEND_MODIFIER_H
47
48#include "BlenderIntermediate.h"
49#include "TinyFormatter.h"
50
51namespace Assimp {
52namespace Blender {
53
54// -------------------------------------------------------------------------------------------
55/** Dummy base class for all blender modifiers. Modifiers are reused between imports, so
56 * they should be stateless and not try to cache model data. */
57// -------------------------------------------------------------------------------------------
58class BlenderModifier
59{
60public:
61 virtual ~BlenderModifier() {
62 // empty
63 }
64
65public:
66
67 // --------------------
68 /** Check if *this* modifier is active, given a ModifierData& block.*/
69 virtual bool IsActive( const ModifierData& /*modin*/) {
70 return false;
71 }
72
73 // --------------------
74 /** Apply the modifier to a given output node. The original data used
75 * to construct the node is given as well. Not called unless IsActive()
76 * was called and gave positive response. */
77 virtual void DoIt(aiNode& /*out*/,
78 ConversionData& /*conv_data*/,
79 const ElemBase& orig_modifier,
80 const Scene& /*in*/,
81 const Object& /*orig_object*/
82 ) {
83 DefaultLogger::get()->warn((Formatter::format("This modifier is not supported, skipping: "),orig_modifier.dna_type));
84 return;
85 }
86};
87
88
89// -------------------------------------------------------------------------------------------
90/** Manage all known modifiers and instance and apply them if necessary */
91// -------------------------------------------------------------------------------------------
92class BlenderModifierShowcase
93{
94public:
95
96 // --------------------
97 /** Apply all requested modifiers provided we support them. */
98 void ApplyModifiers(aiNode& out,
99 ConversionData& conv_data,
100 const Scene& in,
101 const Object& orig_object
102 );
103
104private:
105
106 TempArray< std::vector,BlenderModifier > cached_modifiers;
107};
108
109
110
111
112
113// MODIFIERS
114
115
116
117// -------------------------------------------------------------------------------------------
118/** Mirror modifier. Status: implemented. */
119// -------------------------------------------------------------------------------------------
120class BlenderModifier_Mirror : public BlenderModifier
121{
122public:
123
124 // --------------------
125 virtual bool IsActive( const ModifierData& modin);
126
127 // --------------------
128 virtual void DoIt(aiNode& out,
129 ConversionData& conv_data,
130 const ElemBase& orig_modifier,
131 const Scene& in,
132 const Object& orig_object
133 ) ;
134};
135
136// -------------------------------------------------------------------------------------------
137/** Subdivision modifier. Status: dummy. */
138// -------------------------------------------------------------------------------------------
139class BlenderModifier_Subdivision : public BlenderModifier
140{
141public:
142
143 // --------------------
144 virtual bool IsActive( const ModifierData& modin);
145
146 // --------------------
147 virtual void DoIt(aiNode& out,
148 ConversionData& conv_data,
149 const ElemBase& orig_modifier,
150 const Scene& in,
151 const Object& orig_object
152 ) ;
153};
154
155
156}}
157#endif // !INCLUDED_AI_BLEND_MODIFIER_H
158