HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
GABC_GTUtil.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) COPYRIGHTYEAR
3
* Side Effects Software Inc. All rights reserved.
4
*
5
* Redistribution and use of Houdini Development Kit samples in source and
6
* binary forms, with or without modification, are permitted provided that the
7
* following conditions are met:
8
* 1. Redistributions of source code must retain the above copyright notice,
9
* this list of conditions and the following disclaimer.
10
* 2. The name of Side Effects Software may not be used to endorse or
11
* promote products derived from this software without specific prior
12
* written permission.
13
*
14
* THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS
15
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17
* NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
18
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
20
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
23
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
*
25
*----------------------------------------------------------------------------
26
*/
27
28
#ifndef __GABC_GTUtil__
29
#define __GABC_GTUtil__
30
31
#include "
GABC_API.h
"
32
#include "
GABC_Util.h
"
33
#include <
GT/GT_Types.h
>
34
#include <
Alembic/AbcGeom/All.h
>
35
36
namespace
GABC_NAMESPACE
37
{
38
39
namespace
GABC_GTUtil
40
{
41
/// Given an Alembic DataType, determine the corresponding GT_Storage.
42
static
inline
GT_Storage
43
getGTStorage(
const
Alembic::AbcGeom::DataType
&dtype)
44
{
45
switch
(dtype.
getPod
())
46
{
47
case
Alembic::AbcGeom::kBooleanPOD
:
48
case
Alembic::AbcGeom::kUint8POD
:
49
case
Alembic::AbcGeom::kInt8POD
:
50
return
GT_STORE_UINT8
;
51
case
Alembic::AbcGeom::kUint16POD
:
52
case
Alembic::AbcGeom::kInt16POD
:
53
case
Alembic::AbcGeom::kUint32POD
:
54
case
Alembic::AbcGeom::kInt32POD
:
55
return
GT_STORE_INT32
;
56
case
Alembic::AbcGeom::kUint64POD
:
57
case
Alembic::AbcGeom::kInt64POD
:
58
return
GT_STORE_INT64
;
59
case
Alembic::AbcGeom::kFloat16POD
:
60
return
GT_STORE_REAL16
;
61
case
Alembic::AbcGeom::kFloat32POD
:
62
return
GT_STORE_REAL32
;
63
case
Alembic::AbcGeom::kFloat64POD
:
64
return
GT_STORE_REAL64
;
65
case
Alembic::AbcGeom::kStringPOD
:
66
return
GT_STORE_STRING
;
67
68
case
Alembic::AbcGeom::kWstringPOD
:
69
case
Alembic::AbcGeom::kNumPlainOldDataTypes
:
70
case
Alembic::AbcGeom::kUnknownPOD
:
71
break
;
72
}
73
return
GT_STORE_INVALID
;
74
}
75
76
/// Given an Alembic data type interpretation, determine the corresponding
77
/// GT_Type.
78
static
inline
GT_Type
79
getGTTypeInfo(
const
char
*interp,
int
tsize)
80
{
81
if
(!strcmp(interp,
"point"
))
82
return
GT_TYPE_POINT
;
83
// Maya can generate UV attributes with 2 components and tag them as
84
// vectors. Houdini does not understand vectors with two components
85
// so we drop the vector type info to prevent Houdini from applying
86
// undesired transformation to the values.
87
if
(tsize == 3 && !strcmp(interp,
"vector"
))
88
return
GT_TYPE_VECTOR
;
89
if
(!strcmp(interp,
"matrix"
))
90
return
tsize == 9 ?
GT_TYPE_MATRIX3
:
GT_TYPE_MATRIX
;
91
if
(!strcmp(interp,
"normal"
))
92
return
GT_TYPE_NORMAL
;
93
if
(!strcmp(interp,
"quat"
))
94
return
GT_TYPE_QUATERNION
;
95
if
(!strcmp(interp,
"rgb"
) || !strcmp(interp,
"rgba"
))
96
return
GT_TYPE_COLOR
;
97
if
(!strcmp(interp,
"box"
))
98
return
tsize == 4 ?
GT_TYPE_BOX2
:
GT_TYPE_BOX
;
99
return
GT_TYPE_NONE
;
100
}
101
102
}
// end GABC_GTUtil
103
104
}
// end GABC_NAMESPACE
105
106
#endif
GT_Storage
GT_Storage
Definition:
GT_Types.h:19
Alembic::Util::ALEMBIC_VERSION_NS::kUnknownPOD
Unknown.
Definition:
PlainOldDataType.h:222
GT_STORE_UINT8
Definition:
GT_Types.h:22
GT_STORE_INVALID
Definition:
GT_Types.h:21
GT_STORE_INT64
Definition:
GT_Types.h:26
GT_TYPE_NORMAL
Definition:
GT_Types.h:42
GT_STORE_REAL16
Definition:
GT_Types.h:27
Alembic::Util::ALEMBIC_VERSION_NS::kInt64POD
Definition:
PlainOldDataType.h:205
GT_Type
GT_Type
Definition:
GT_Types.h:36
GT_TYPE_COLOR
Definition:
GT_Types.h:43
All.h
GT_TYPE_BOX2
Definition:
GT_Types.h:49
Alembic::Util::ALEMBIC_VERSION_NS::kUint16POD
Short/UShort.
Definition:
PlainOldDataType.h:196
GT_TYPE_NONE
Definition:
GT_Types.h:38
GABC_API.h
GABC_NAMESPACE
#define GABC_NAMESPACE
Definition:
GABC_API.h:42
Alembic::Util::ALEMBIC_VERSION_NS::kInt32POD
Definition:
PlainOldDataType.h:201
GT_TYPE_BOX
Definition:
GT_Types.h:50
Alembic::Util::ALEMBIC_VERSION_NS::kUint8POD
Char/UChar.
Definition:
PlainOldDataType.h:192
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::DataType
Definition:
DataType.h:50
Alembic::Util::ALEMBIC_VERSION_NS::kInt16POD
Definition:
PlainOldDataType.h:197
GT_TYPE_QUATERNION
Definition:
GT_Types.h:44
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::DataType::getPod
PlainOldDataType getPod() const
Definition:
DataType.h:74
GT_STORE_REAL32
Definition:
GT_Types.h:28
GT_STORE_REAL64
Definition:
GT_Types.h:29
GT_TYPE_MATRIX
Definition:
GT_Types.h:46
Alembic::Util::ALEMBIC_VERSION_NS::kBooleanPOD
Definition:
PlainOldDataType.h:189
GT_TYPE_VECTOR
Definition:
GT_Types.h:41
GT_TYPE_MATRIX3
Definition:
GT_Types.h:45
Alembic::Util::ALEMBIC_VERSION_NS::kInt8POD
Definition:
PlainOldDataType.h:193
Alembic::Util::ALEMBIC_VERSION_NS::kFloat32POD
Definition:
PlainOldDataType.h:209
GT_TYPE_POINT
Definition:
GT_Types.h:39
Alembic::Util::ALEMBIC_VERSION_NS::kNumPlainOldDataTypes
Number of POD.
Definition:
PlainOldDataType.h:219
GT_STORE_INT32
Definition:
GT_Types.h:25
Alembic::Util::ALEMBIC_VERSION_NS::kWstringPOD
Wide String Pointer.
Definition:
PlainOldDataType.h:216
Alembic::Util::ALEMBIC_VERSION_NS::kStringPOD
String Pointer.
Definition:
PlainOldDataType.h:213
Alembic::Util::ALEMBIC_VERSION_NS::kFloat64POD
Definition:
PlainOldDataType.h:210
Alembic::Util::ALEMBIC_VERSION_NS::kUint64POD
Long/ULong.
Definition:
PlainOldDataType.h:204
Alembic::Util::ALEMBIC_VERSION_NS::kFloat16POD
Half/Float/Double.
Definition:
PlainOldDataType.h:208
Alembic::Util::ALEMBIC_VERSION_NS::kUint32POD
Int/UInt.
Definition:
PlainOldDataType.h:200
GT_Types.h
GABC_Util.h
GT_STORE_STRING
Definition:
GT_Types.h:30
GABC
GABC_GTUtil.h
Generated on Sun Nov 17 2024 03:01:11 for HDK by
1.8.6