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