1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: gfx_ResShape.h 4 5 Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Revision: 18106 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NW_GFX_RESSHAPE_H_ 17 #define NW_GFX_RESSHAPE_H_ 18 19 #include <nw/ut/ut_ResUtil.h> 20 #include <nw/ut/ut_ResDictionary.h> 21 #include <nw/gfx/res/gfx_ResSceneObject.h> 22 #include <nw/gfx/res/gfx_ResVertex.h> 23 #include <nw/math/math_ResTypes.h> 24 #include <nw/gfx/res/gfx_ResTypeInfo.h> 25 #include <nw/ut/ut_ResPrimitive.h> 26 27 namespace nw { 28 namespace gfx { 29 namespace res { 30 31 //=================================== 32 // ブレンドシェイプクラス 33 //=================================== 34 //! @details :private 35 struct ResTargetShapeData 36 { 37 nw::ut::ResTypeInfo typeInfo; 38 nw::ut::ResS32 m_VertexAttributesTableCount; 39 nw::ut::Offset toVertexAttributesTable; 40 }; 41 42 //! @details :private 43 struct ResBlendShapeData 44 { 45 nw::ut::ResTypeInfo typeInfo; 46 nw::ut::ResS32 m_TargetShapesTableCount; 47 nw::ut::Offset toTargetShapesTable; 48 nw::ut::ResS32 m_UsageTableTableCount; 49 nw::ut::Offset toUsageTableTable; 50 }; 51 52 //-------------------------------------------------------------------------- 53 //! @brief ブレンドシェイプのターゲットシェイプを管理する為バイナリリソースクラスです。 54 //! @details :private 55 //--------------------------------------------------------------------------- 56 class ResTargetShape : public nw::ut::ResCommon<ResTargetShapeData> 57 { 58 public: 59 NW_RES_CTOR( ResTargetShape ) 60 61 NW_RES_FIELD_CLASS_LIST_DECL( ResVertexAttribute, VertexAttributes ) 62 }; 63 64 //-------------------------------------------------------------------------- 65 //! @brief ターゲットシェイプを合成してシェイプをブレンドするための情報を表すバイナリリソースクラスです。 66 //! @details :private 67 //--------------------------------------------------------------------------- 68 class ResBlendShape : public nw::ut::ResCommon<ResBlendShapeData> 69 { 70 public: 71 NW_RES_CTOR( ResBlendShape ) 72 73 NW_RES_FIELD_CLASS_LIST_DECL( ResTargetShape, TargetShapes ) 74 NW_RES_FIELD_PRIMITIVE_LIST_DECL( u32, UsageTable ) 75 }; 76 77 //=================================== 78 // プリミティブクラス 79 //=================================== 80 //! @details :private 81 struct ResPrimitiveData 82 { 83 nw::ut::ResS32 m_IndexStreamsTableCount; 84 nw::ut::Offset toIndexStreamsTable; 85 nw::ut::ResS32 m_BufferObjectsTableCount; 86 nw::ut::Offset toBufferObjectsTable; 87 nw::ut::ResU32 m_Flags; 88 nw::os::IAllocator* m_CommandAllocator; 89 }; 90 91 //-------------------------------------------------------------------------- 92 //! @brief シェイプを構成する一つのプリミティブを表すバイナリリソースクラスです。 93 //--------------------------------------------------------------------------- 94 class ResPrimitive : public nw::ut::ResCommon< ResPrimitiveData > 95 { 96 public: 97 enum Flag 98 { 99 FLAG_COMMAND_HAS_BEEN_SETUP = 0x1 << 0 //!< 既にコマンドキャッシュがセットアップ済みかどうかのフラグです。 100 }; 101 102 NW_RES_CTOR( ResPrimitive ) 103 104 //--------------------------------------------------------------------------- 105 //! @fn void SetBufferObjects(int idx, u32 value) 106 //! @brief バッファオブジェクトのリストに要素を設定します。 107 //--------------------------------------------------------------------------- 108 //--------------------------------------------------------------------------- 109 //! @fn s32 GetIndexStreamsCount() const 110 //! @brief 頂点インデックスのストリームの要素数を取得します。 111 //--------------------------------------------------------------------------- 112 //--------------------------------------------------------------------------- 113 //! @fn ResIndexStream GetIndexStreams(int idx) 114 //! @brief 頂点インデックスのストリームを取得します。 115 //--------------------------------------------------------------------------- 116 //--------------------------------------------------------------------------- 117 //! @fn s32 GetBufferObjectsCount() const 118 //! @brief バッファオブジェクトの要素数を取得します。 119 //--------------------------------------------------------------------------- 120 //--------------------------------------------------------------------------- 121 //! @fn u32 GetBufferObjects(int idx) const 122 //! @brief バッファオブジェクトを取得します。 123 //--------------------------------------------------------------------------- 124 NW_RES_FIELD_CLASS_LIST_DECL( ResIndexStream, IndexStreams ) // GetIndexStreams(int idx), GetIndexStreamsCount() 125 NW_RES_FIELD_PRIMITIVE_LIST_DECL( u32, BufferObjects ) // GetBufferObjects(), GetBufferObjects(int idx), GetBufferObjectsCount() 126 127 //--------------------------------------------------------------------------- 128 //! @fn u32 GetFlags() const 129 //! @brief フラグの値を取得します。 130 //--------------------------------------------------------------------------- 131 //--------------------------------------------------------------------------- 132 //! @fn void SetFlags(u32 value) 133 //! @brief フラグの値を設定します。 134 //! 設定されなかったフラグは無効になります。 135 //--------------------------------------------------------------------------- 136 //--------------------------------------------------------------------------- 137 //! @fn void EnaleFlags(u32 value) 138 //! @brief 指定された Flag の値を有効にします。 139 //! 設定されなかったフラグは変更されません。 140 //--------------------------------------------------------------------------- 141 //--------------------------------------------------------------------------- 142 //! @fn void DisableFlags(u32 value) 143 //! @brief 指定された Flag の値を無効にします。 144 //! 設定されなかったフラグは変更されません。 145 //--------------------------------------------------------------------------- 146 NW_RES_FIELD_FLAGS_DECL( u32, Flags ) // GetFlags(), SetFlags(), EnableFlags(), DisableFlags() 147 148 //--------------------------------------------------------------------------- 149 //! @brief リソースの初期化処理をおこないます。 150 //--------------------------------------------------------------------------- 151 void Setup(nw::os::IAllocator* allocator); 152 153 //--------------------------------------------------------------------------- 154 //! @brief リソースの解放準備をおこないます。 155 //--------------------------------------------------------------------------- 156 void Cleanup(); 157 158 //--------------------------------------------------------------------------- 159 //! @details :private 160 //! 161 //! @brief 描画用のコマンドを構築します。 162 //--------------------------------------------------------------------------- 163 void SetupDrawCommand(bool hasGeometryShader); 164 }; 165 typedef nw::ut::ResArrayClass<ResPrimitive>::type ResPrimitiveArray; 166 167 168 //! @details :private 169 struct ResPrimitiveSetData 170 { 171 nw::ut::ResS32 m_BoneIndexTableTableCount; 172 nw::ut::Offset toBoneIndexTableTable; 173 nw::ut::ResS32 m_SkinningMode; 174 nw::ut::ResS32 m_PrimitivesTableCount; 175 nw::ut::Offset toPrimitivesTable; 176 }; 177 178 //-------------------------------------------------------------------------- 179 //! @brief 同一のマトリクス群に影響する複数のプリミティブを表すバイナリリソースクラスです。 180 //--------------------------------------------------------------------------- 181 class ResPrimitiveSet : public nw::ut::ResCommon< ResPrimitiveSetData > 182 { 183 public: 184 //! @brief スキニングモードを表します。 185 enum SkinningModeType 186 { 187 SKINNING_MODE_NONE, //!< スキニング無しの設定です。 188 SKINNING_MODE_RIGID, //!< リジッドスキニングの設定です。 189 SKINNING_MODE_SMOOTH //!< スムーススキニングの設定です。 190 }; 191 192 NW_RES_CTOR( ResPrimitiveSet ) 193 194 //--------------------------------------------------------------------------- 195 //! @fn void SetSkinningMode(s32 value) 196 //! @brief スキニングのモードを設定します。 197 //--------------------------------------------------------------------------- 198 //--------------------------------------------------------------------------- 199 //! @fn void SetBoneIndexTable(int idx, s32 value) 200 //! @brief ボーンインデックスのテーブルのリストに要素を設定します。 201 //--------------------------------------------------------------------------- 202 //--------------------------------------------------------------------------- 203 //! @fn s32 GetSkinningMode() const 204 //! @brief スキニングのモードを取得します。 205 //--------------------------------------------------------------------------- 206 //--------------------------------------------------------------------------- 207 //! @fn s32 GetPrimitivesCount() const 208 //! @brief プリミティブの要素数を取得します。 209 //--------------------------------------------------------------------------- 210 //--------------------------------------------------------------------------- 211 //! @fn ResPrimitive GetPrimitives(int idx) 212 //! @brief プリミティブを取得します。 213 //--------------------------------------------------------------------------- 214 //--------------------------------------------------------------------------- 215 //! @fn s32 GetBoneIndexTableCount() const 216 //! @brief ボーンインデックスのテーブルの要素数を取得します。 217 //--------------------------------------------------------------------------- 218 //--------------------------------------------------------------------------- 219 //! @fn s32 GetBoneIndexTable(int idx) const 220 //! @brief ボーンインデックスのテーブルを取得します。 221 //--------------------------------------------------------------------------- 222 NW_RES_FIELD_PRIMITIVE_LIST_DECL( s32, BoneIndexTable ) // GetBoneIndexTable(), GetBoneIndexTable(int idx), GetBoneIndexTableCount() 223 NW_RES_FIELD_PRIMITIVE_DECL( s32, SkinningMode ) // GetSkinningMode(), SetSkinningMode() 224 NW_RES_FIELD_CLASS_LIST_DECL( ResPrimitive, Primitives ) // GetPrimitives(int idx), GetPrimitivesCount() 225 226 //--------------------------------------------------------------------------- 227 //! @brief リソースの初期化処理をおこないます。 228 //--------------------------------------------------------------------------- 229 void Setup(nw::os::IAllocator* allocator); 230 231 //--------------------------------------------------------------------------- 232 //! @brief リソースの解放準備をおこないます。 233 //--------------------------------------------------------------------------- 234 void Cleanup(); 235 }; 236 typedef nw::ut::ResArrayClass<ResPrimitiveSet>::type ResPrimitiveSetArray; 237 238 239 //=================================== 240 // シェイプクラス 241 //=================================== 242 //! @details :private 243 struct ResShapeData : public ResSceneObjectData 244 { 245 nw::ut::ResU32 m_Flags; 246 nw::ut::Offset toBoundingVolume; 247 nw::ut::ResVec3 m_PositionOffset; 248 nw::ut::ResS32 m_PrimitiveSetsTableCount; 249 nw::ut::Offset toPrimitiveSetsTable; 250 u32 m_BaseAddress; 251 }; 252 253 //-------------------------------------------------------------------------- 254 //! @brief 頂点によって構成される形状を表すバイナリリソースクラスです。 255 //--------------------------------------------------------------------------- 256 class ResShape : public ResSceneObject 257 { 258 public: 259 enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResShape) }; 260 enum { SIGNATURE = NW_RES_SIGNATURE32('SHOB') }; 261 262 enum Flag 263 { 264 FLAG_HAS_BEEN_SETUP = 0x1 << 0 //!< 既にセットアップ済みであることを示すフラグ 265 }; 266 NW_RES_CTOR_INHERIT(ResShape,ResSceneObject)267 NW_RES_CTOR_INHERIT( ResShape, ResSceneObject ) 268 269 //--------------------------------------------------------------------------- 270 //! @fn u32 GetFlags() const 271 //! @brief フラグの値を取得します。 272 //--------------------------------------------------------------------------- 273 //--------------------------------------------------------------------------- 274 //! @fn void SetFlags(u32 value) 275 //! @brief フラグの値を設定します。 276 //! 設定されなかったフラグは無効になります。 277 //--------------------------------------------------------------------------- 278 //--------------------------------------------------------------------------- 279 //! @fn void EnaleFlags(u32 value) 280 //! @brief 指定された Flag の値を有効にします。 281 //! 設定されなかったフラグは変更されません。 282 //--------------------------------------------------------------------------- 283 //--------------------------------------------------------------------------- 284 //! @fn void DisableFlags(u32 value) 285 //! @brief 指定された Flag の値を無効にします。 286 //! 設定されなかったフラグは変更されません。 287 //--------------------------------------------------------------------------- 288 NW_RES_FIELD_FLAGS_DECL( u32, Flags ) // GetFlags(), SetFlags(), EnableFlags(), DisableFlags() 289 290 //--------------------------------------------------------------------------- 291 //! @fn nw::ut::ResBoundingVolume GetBoundingVolume() 292 //! @brief 指向性境界ボックスを取得します。 293 //--------------------------------------------------------------------------- 294 NW_RES_FIELD_CLASS_DECL( nw::ut::ResBoundingVolume, BoundingVolume) // GetBoundingVolume() 295 296 //--------------------------------------------------------------------------- 297 //! @fn nw::ut::ResOrientedBoundingBox GetOrientedBoundingBox() 298 //! @brief 指向性境界ボックスを取得します。 299 //--------------------------------------------------------------------------- 300 nw::ut::ResOrientedBoundingBox GetOrientedBoundingBox() 301 { 302 nw::ut::ResOrientedBoundingBox resOBB( ref().toBoundingVolume.to_ptr() ); 303 304 NW_ASSERT( resOBB.IsValid() || (resOBB.GetTypeInfo() == nw::ut::ResOrientedBoundingBox::TYPE_INFO) ); 305 return resOBB; 306 } 307 GetOrientedBoundingBox()308 const nw::ut::ResOrientedBoundingBox GetOrientedBoundingBox() const 309 { 310 const nw::ut::ResOrientedBoundingBox resOBB( ref().toBoundingVolume.to_ptr() ); 311 312 NW_ASSERT( resOBB.IsValid() || (resOBB.GetTypeInfo() == nw::ut::ResOrientedBoundingBox::TYPE_INFO) ); 313 return resOBB; 314 } 315 316 //--------------------------------------------------------------------------- 317 //! @fn nw::ut::ResOrientedBoundingBoxData & GetOrientedBoundingBoxData() 318 //! @brief 指向性境界ボックスを取得します。 319 //--------------------------------------------------------------------------- GetOrientedBoundingBoxData()320 nw::ut::ResOrientedBoundingBoxData& GetOrientedBoundingBoxData() 321 { 322 return this->GetOrientedBoundingBox().ref(); 323 } 324 GetOrientedBoundingBoxData()325 const nw::ut::ResOrientedBoundingBoxData& GetOrientedBoundingBoxData() const 326 { 327 return this->GetOrientedBoundingBox().ref(); 328 } 329 330 //--------------------------------------------------------------------------- 331 //! @fn const nw::math::VEC3 & GetPositionOffset() const 332 //! @brief 座標情報に加算するオフセット値を取得します。 333 //--------------------------------------------------------------------------- 334 //--------------------------------------------------------------------------- 335 //! @fn void SetPositionOffset(f32 x, f32 y, f32 z) 336 //! @brief 座標情報に加算するオフセット値を設定します。 337 //--------------------------------------------------------------------------- NW_RES_FIELD_VECTOR3_DECL(nw::math::VEC3,PositionOffset)338 NW_RES_FIELD_VECTOR3_DECL( nw::math::VEC3, PositionOffset ) // GetPositionOffset() 339 340 //--------------------------------------------------------------------------- 341 //! @fn s32 GetPrimitiveSetsCount() const 342 //! @brief プリミティブの集合の要素数を取得します。 343 //--------------------------------------------------------------------------- 344 //--------------------------------------------------------------------------- 345 //! @fn ResPrimitiveSet GetPrimitiveSets(int idx) 346 //! @brief プリミティブの集合を取得します。 347 //--------------------------------------------------------------------------- 348 NW_RES_FIELD_CLASS_LIST_DECL( ResPrimitiveSet, PrimitiveSets ) // GetPrimitiveSets(int idx), GetPrimitiveSetsCount() 349 350 //-------------------------------------------------------------------------- 351 //! @brief ローカルな中心位置を取得します。 352 //! 353 //! @return ローカルな中心位置の座標です。 354 //--------------------------------------------------------------------------- 355 const nw::math::VEC3& GetCenterPosition() const { return this->GetOrientedBoundingBox().GetCenterPosition(); } 356 357 //-------------------------------------------------------------------------- 358 //! @brief ローカルな中心位置を設定します。 359 //! 360 //! @param[in] x 中心位置の x 座標です。 361 //! @param[in] y 中心位置の y 座標です。 362 //! @param[in] z 中心位置の z 座標です。 363 //--------------------------------------------------------------------------- SetCenterPosition(f32 x,f32 y,f32 z)364 void SetCenterPosition( f32 x, f32 y, f32 z ) { return this->GetOrientedBoundingBox().SetCenterPosition(x, y, z); } 365 366 //-------------------------------------------------------------------------- 367 //! @brief ローカルな中心位置を設定します。 368 //! 369 //! @param[in] value 中心位置の座標です。 370 //--------------------------------------------------------------------------- SetCenterPosition(const nw::math::VEC3 & value)371 void SetCenterPosition(const nw::math::VEC3& value) { return this->GetOrientedBoundingBox().SetCenterPosition(value); } 372 373 //! @brief リソースの初期化をおこないます。 374 Result Setup(nw::os::IAllocator* allocator); 375 376 //! @brief リソースの後始末をおこないます。 377 void Cleanup(); 378 }; 379 typedef nw::ut::ResArrayClass<ResShape>::type ResShapeArray; 380 381 382 //! @details :private 383 struct ResSeparateDataShapeData : public ResShapeData 384 { 385 nw::ut::ResS32 m_VertexAttributesTableCount; 386 nw::ut::Offset toVertexAttributesTable; 387 nw::ut::Offset toBlendShape; 388 }; 389 390 391 //-------------------------------------------------------------------------- 392 //! @brief 複数の属性を組み合わせて形状を現すバイナリリソースクラスです。 393 //--------------------------------------------------------------------------- 394 class ResSeparateDataShape : public ResShape 395 { 396 public: 397 enum { TYPE_INFO = NW_GFX_RES_TYPE_INFO(ResSeparateDataShape) }; 398 enum { SIGNATURE = NW_RES_SIGNATURE32('SPSH') }; 399 400 NW_RES_CTOR_INHERIT( ResSeparateDataShape, ResShape ) 401 402 //--------------------------------------------------------------------------- 403 //! @fn s32 GetVertexAttributesCount() const 404 //! @brief 頂点属性の要素数を取得します。 405 //--------------------------------------------------------------------------- 406 //--------------------------------------------------------------------------- 407 //! @fn ResVertexAttribute GetVertexAttributes(int idx) 408 //! @brief 頂点属性を取得します。 409 //--------------------------------------------------------------------------- 410 //--------------------------------------------------------------------------- 411 //! @fn ResBlendShape GetBlendShape() 412 //! @brief ブレンドシェイプの設定を取得します。 413 //--------------------------------------------------------------------------- 414 NW_RES_FIELD_CLASS_LIST_DECL( ResVertexAttribute, VertexAttributes ) // GetVertexAttributes(int idx), GetVertexAttributesCount() 415 NW_RES_FIELD_CLASS_DECL( ResBlendShape, BlendShape ) // GetBlendShape() 416 }; 417 418 } // namespace res 419 420 namespace internal { 421 422 //-------------------------------------------------------------------------- 423 //! @brief ResInterleavedVertexStream に含まれる実データを持たない内部頂点属性も含めて列挙するイテレータです。 424 //! 425 //! @detail nw::gfx::GatherVertexAttributes 関数で取得します。 426 //--------------------------------------------------------------------------- 427 class ResVertexAttributeIterator 428 { 429 public: 430 //--------------------------------------------------------------------------- 431 //! @brief シェイプから、ResVertexAttributeIterator を生成します。 432 //! 433 //! @param[in] shape シェイプリソースです。 434 //! 435 //! @return 先頭の頂点属性を指すイテレータです。 436 //--------------------------------------------------------------------------- Begin(ResSeparateDataShape shape)437 static ResVertexAttributeIterator Begin(ResSeparateDataShape shape) 438 { 439 return ResVertexAttributeIterator(shape); 440 } 441 442 //--------------------------------------------------------------------------- 443 //! @brief コピーコンストラクタです。 444 //! 445 //! @param[in] value コピー元の値です。 446 //--------------------------------------------------------------------------- ResVertexAttributeIterator(const ResVertexAttributeIterator & value)447 /* implicit */ ResVertexAttributeIterator(const ResVertexAttributeIterator& value) 448 : m_Shape( value.m_Shape ), 449 m_Interleave( value.m_Interleave ), 450 m_IndexOnShape( value.m_IndexOnShape ), 451 m_IndexOnInterleave( value.m_IndexOnInterleave ) 452 { 453 } 454 455 //--------------------------------------------------------------------------- 456 //! @brief イテレータが有効な値を指しているかどうかを取得します。 457 //! 458 //! @return 有効な値であれば true、そうでなければ false を返します。 459 //--------------------------------------------------------------------------- IsValid()460 bool IsValid() const 461 { 462 return (m_IndexOnShape >= 0); 463 } 464 465 //--------------------------------------------------------------------------- 466 //! @brief ポインタ参照演算子です。 467 //! 468 //! @return イテレータの指している頂点属性を返します。 469 //--------------------------------------------------------------------------- 470 ResVertexAttribute operator*() 471 { 472 if (m_Interleave.IsValid()) 473 { 474 return m_Interleave.GetVertexStreams( m_IndexOnInterleave ); 475 } 476 else 477 { 478 return m_Shape.GetVertexAttributes( m_IndexOnShape ); 479 } 480 } 481 482 //--------------------------------------------------------------------------- 483 //! @brief ポインタ参照演算子です。 484 //! 485 //! @return イテレータの指している頂点属性を返します。 486 //--------------------------------------------------------------------------- 487 const ResVertexAttribute operator*() const 488 { 489 if (m_Interleave.IsValid()) 490 { 491 return m_Interleave.GetVertexStreams( m_IndexOnInterleave ); 492 } 493 else 494 { 495 return m_Shape.GetVertexAttributes( m_IndexOnShape ); 496 } 497 } 498 499 500 //--------------------------------------------------------------------------- 501 //! @brief 前置のインクリメント演算子です。 502 //! 503 //! @return インクリメント後のイテレータを返します。 504 //--------------------------------------------------------------------------- 505 ResVertexAttributeIterator& operator++() 506 { 507 if (m_Interleave.IsValid()) 508 { 509 ++m_IndexOnInterleave; 510 if (m_Interleave.GetVertexStreamsCount() > m_IndexOnInterleave) 511 { 512 return *this; 513 } 514 515 m_Interleave = ResInterleavedVertexStream(NULL); 516 m_IndexOnInterleave = -1; 517 } 518 519 ++m_IndexOnShape; 520 if (m_Shape.GetVertexAttributesCount() > m_IndexOnShape) 521 { 522 ResVertexAttribute attribute = m_Shape.GetVertexAttributes(m_IndexOnShape); 523 524 if (attribute.GetFlags() & ResVertexAttribute::FLAG_INTERLEAVE) 525 { 526 m_Interleave = ResStaticCast<ResInterleavedVertexStream>( attribute ); 527 m_IndexOnInterleave = 0; 528 } 529 } 530 else 531 { 532 m_IndexOnShape = -1; 533 } 534 535 return *this; 536 } 537 538 //--------------------------------------------------------------------------- 539 //! @brief 後置のインクリメント演算子です。 540 //! 541 //! @return インクリメント前のイテレータを返します。 542 //--------------------------------------------------------------------------- 543 ResVertexAttributeIterator operator++(int) 544 { 545 ResVertexAttributeIterator copy = *this; 546 547 this->operator++(); 548 549 return copy; 550 } 551 552 private: 553 ResSeparateDataShape m_Shape; 554 ResInterleavedVertexStream m_Interleave; 555 s32 m_IndexOnShape; 556 s32 m_IndexOnInterleave; 557 558 //--------------------------------------------------------------------------- 559 //! @brief コンストラクタです。 560 //! 561 //! @param[in] shape 562 //--------------------------------------------------------------------------- 563 ResVertexAttributeIterator(ResSeparateDataShape shape)564 explicit ResVertexAttributeIterator(ResSeparateDataShape shape) 565 : m_Shape( shape ), 566 m_Interleave( ResInterleavedVertexStream(NULL) ), 567 m_IndexOnShape( 0 ), 568 m_IndexOnInterleave( -1 ) 569 { 570 NW_ASSERT( shape.IsValid() ); 571 572 ResVertexAttribute attribute = shape.GetVertexAttributes(0); 573 574 if (attribute.GetFlags() & ResVertexAttribute::FLAG_INTERLEAVE) 575 { 576 m_Interleave = ResStaticCast<ResInterleavedVertexStream>( attribute ); 577 m_IndexOnInterleave = 0; 578 } 579 } 580 }; 581 582 } // namespace internal 583 584 } // namespace gfx 585 } // namespace nw 586 587 #endif // NW_GFX_RESSHAPE_H_ 588