~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to COLLADAMax/src/COLLADAMaxSkinInterface.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
This file is part of COLLADAMax.
 
5
 
 
6
Portions of the code are:
 
7
Copyright (c) 2005-2007 Feeling Software Inc.
 
8
Copyright (c) 2005-2007 Sony Computer Entertainment America
 
9
 
 
10
Based on the 3dsMax COLLADASW Tools:
 
11
Copyright (c) 2005-2006 Autodesk Media Entertainment
 
12
 
 
13
Licensed under the MIT Open Source License, 
 
14
for details please see LICENSE file or the website
 
15
http://www.opensource.org/licenses/mit-license.php
 
16
*/
 
17
 
 
18
#include "COLLADAMaxStableHeaders.h"
 
19
#include "COLLADAMaxSkinInterface.h"
 
20
 
 
21
#include "max.h"
 
22
#include "iskin.h"
 
23
 
 
24
namespace COLLADAMax
 
25
{
 
26
 
 
27
        // ONLY CONSTRUCTOR: Assumes we have been called with correct
 
28
        // modifier
 
29
        SkinInterface::SkinInterface(Modifier *modifier, INode *node )
 
30
                : mInode( node )
 
31
                , mModifier( modifier ) 
 
32
                , mModifierInterface( modifier ? (ISkin*)mModifier->GetInterface(I_SKIN) : 0 )
 
33
                , mSkinContext( (node && mModifierInterface) ? mModifierInterface->GetContextInterface(node) : 0)
 
34
        {
 
35
                assert( mModifier );
 
36
                assert( mModifierInterface );
 
37
                assert( !node || mSkinContext );
 
38
        }
 
39
 
 
40
        // Release our interface on death
 
41
        SkinInterface::~SkinInterface()
 
42
        {
 
43
                // Check to make sure we are released
 
44
                // If we are not, someone has forgotten
 
45
                // about us!
 
46
                assert( !mModifierInterface );
 
47
        }
 
48
 
 
49
        void SkinInterface::releaseMe()
 
50
        {
 
51
                mModifier->ReleaseInterface(I_SKIN, (void*)mModifierInterface);
 
52
                mModifierInterface = 0;
 
53
                delete this;
 
54
        }
 
55
 
 
56
        bool SkinInterface::getSkinInitTM(Matrix3 &initTM, bool bObjOffset)
 
57
        {
 
58
                assert( mInode );
 
59
                return mModifierInterface->GetSkinInitTM(mInode, initTM, bObjOffset) == SKIN_OK;
 
60
        }
 
61
 
 
62
        int SkinInterface::getNumBones()
 
63
        {
 
64
                return mModifierInterface->GetNumBones();
 
65
        }
 
66
 
 
67
        INode *SkinInterface::getBone(int i)
 
68
        {
 
69
                return mModifierInterface->GetBone(i);
 
70
        }
 
71
 
 
72
        bool SkinInterface::getBoneInitTM(INode *node, Matrix3 &boneInitTM)
 
73
        {
 
74
                return mModifierInterface->GetBoneInitTM(node, boneInitTM) == SKIN_OK;
 
75
        }
 
76
 
 
77
        int SkinInterface::getNumVertices()
 
78
        {
 
79
                assert( mSkinContext );
 
80
                return mSkinContext->GetNumPoints();
 
81
        }
 
82
 
 
83
        int SkinInterface::getNumAssignedBones(int i)
 
84
        {
 
85
                assert( mSkinContext );
 
86
                return mSkinContext->GetNumAssignedBones(i);
 
87
        }
 
88
 
 
89
        float SkinInterface::getBoneWeight(int vertexIdx, int boneIdx)
 
90
        {
 
91
                assert( mSkinContext );
 
92
                return mSkinContext->GetBoneWeight(vertexIdx, boneIdx);
 
93
        }
 
94
 
 
95
        int SkinInterface::getAssignedBone(int vertexIdx, int boneIdx)
 
96
        {
 
97
                assert( mSkinContext );
 
98
                return mSkinContext->GetAssignedBone(vertexIdx, boneIdx);
 
99
        }
 
100
 
 
101
 
 
102
} // namespace COLLADAMax