1 From 3f68b25b9085c577c2cc2db81d9a9f743de077b7 Mon Sep 17 00:00:00 2001
2 From: Fabrice Robinet <fabricerobinet@me.com>
3 Date: Thu, 22 May 2014 15:15:40 -0700
4 Subject: [PATCH 2/2] Expose sid for textures in extras.
7 COLLADAFramework/include/COLLADAFWSampler.h | 8 +++++++-
8 .../src/COLLADASaxFWLLibraryEffectsLoader.cpp | 4 +++-
9 2 files changed, 10 insertions(+), 2 deletions(-)
11 diff --git a/COLLADAFramework/include/COLLADAFWSampler.h b/COLLADAFramework/include/COLLADAFWSampler.h
12 index 44936a8..562e47a 100644
13 --- a/COLLADAFramework/include/COLLADAFWSampler.h
14 +++ b/COLLADAFramework/include/COLLADAFWSampler.h
15 @@ -129,6 +129,9 @@ namespace COLLADAFW
16 that is used by the sampler to evaluate the MIPmap chain. */
19 + /* sampler Sid, required to be able to retrieve a sampler from extras */
25 @@ -203,8 +206,11 @@ namespace COLLADAFW
26 /** Returns the mipmap Bias.*/
27 void setMipmapBias ( float mipmapBias ) { mMipmapBias = mipmapBias; }
29 - Sampler* clone() { return FW_NEW Sampler(*this); }
30 + void setSid( const std::string &sid) { mSid = sid; }
32 + const std::string& getSid() { return mSid; }
34 + Sampler* clone() { return FW_NEW Sampler(*this); }
38 diff --git a/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp b/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp
39 index 36f9c58..5ac99a4 100644
40 --- a/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp
41 +++ b/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp
42 @@ -1003,18 +1003,20 @@ namespace COLLADASaxFWL
44 bool validSampler = false;
45 SidSamplerInfoMap::iterator samplerIt = mEffectProfileSidSamplerInfoMap.find ( samplerSid );
47 if ( samplerIt == mEffectProfileSidSamplerInfoMap.end () )
49 samplerIt = mEffectSidSamplerInfoMap.find ( samplerSid );
50 if ( samplerIt != mEffectSidSamplerInfoMap.end () ) validSampler = true;
52 else validSampler = true;
57 SamplerInfo& samplerInfo = samplerIt->second;
58 samplerInfo.id = samplerArray.getCount();
59 COLLADAFW::Sampler* sampler = samplerInfo.sampler;
60 + sampler->setSid(samplerSid);
61 if ( !sampler->getSourceImage().isValid() )
63 bool validSurface = false;