From 388eba1ea2d19f49892e6a52bdf5507b993dc9ca Mon Sep 17 00:00:00 2001 From: nokotan Date: Mon, 28 Sep 2020 13:02:59 +0900 Subject: [PATCH] =?UTF-8?q?update=20to=203.22a=20(=E5=85=B1=E9=80=9A?= =?UTF-8?q?=E9=83=A8=E5=88=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DxASyncLoad.cpp | 2 +- DxASyncLoad.h | 2 +- DxArchive_.cpp | 2 +- DxArchive_.h | 2 +- DxBaseFunc.cpp | 2 +- DxBaseFunc.h | 2 +- DxBaseImage.cpp | 72 +++-- DxBaseImage.h | 2 +- DxChar.cpp | 2 +- DxChar.h | 2 +- DxCharCodeTable.cpp | 2 +- DxCompileConfig.h | 2 +- DxDataType.h | 2 +- DxDataTypeAndroid.h | 2 +- DxDataTypeHTML5.h | 2 +- DxDataTypeWin.h | 2 +- DxDataTypeiOS.h | 2 +- DxFile.cpp | 2 +- DxFile.h | 2 +- DxFont.cpp | 29 +- DxFont.h | 2 +- DxFunctionAndroid.h | 2 +- DxFunctionWin.h | 5 +- DxFunctioniOS.h | 2 +- DxGateway.cpp | 87 +++++- DxGraphics.cpp | 51 ++-- DxGraphics.h | 3 +- DxGraphicsFilter.cpp | 231 ++++++++++++++-- DxGraphicsFilter.h | 15 +- DxHandle.cpp | 2 +- DxHandle.h | 12 +- DxHeap.cpp | 2 +- DxHeap.h | 2 +- DxInput.cpp | 2 +- DxInput.h | 2 +- DxInputString.cpp | 2 +- DxInputString.h | 2 +- DxLib.h | 69 +++-- DxLib.txt | 2 +- DxLive2DCubism4.cpp | 11 +- DxLive2DCubism4.h | 70 ++--- DxLog.cpp | 2 +- DxLog.h | 2 +- DxLog.txt | 64 ++++- DxMask.cpp | 2 +- DxMask.h | 2 +- DxMath.cpp | 2 +- DxMath.h | 2 +- DxMemImg.cpp | 2 +- DxMemImg.h | 2 +- DxMemImgDrawFunction0.cpp | 2 +- DxMemImgDrawFunction1.cpp | 2 +- DxMemImgDrawFunction2.cpp | 2 +- DxMemImgDrawFunction3.cpp | 2 +- DxMemory.cpp | 2 +- DxMemory.h | 2 +- DxModel.cpp | 113 +++++++- DxModel.h | 8 +- DxModelFile.h | 2 +- DxModelLoader0.cpp | 2 +- DxModelLoader1.cpp | 544 ++++++++++++++++++++++++++++--------- DxModelLoader2.cpp | 2 +- DxModelLoader3.cpp | 2 +- DxModelLoader3.h | 2 +- DxModelLoader4.cpp | 2 +- DxModelLoader4.h | 2 +- DxModelLoaderVMD.cpp | 2 +- DxModelLoaderVMD.h | 2 +- DxModelRead.cpp | 4 +- DxModelRead.h | 2 +- DxMovie.cpp | 2 +- DxMovie.h | 2 +- DxNetwork.cpp | 2 +- DxNetwork.h | 2 +- DxRingBuffer.cpp | 2 +- DxRingBuffer.h | 2 +- DxSoftImage.cpp | 2 +- DxSoftImage.h | 2 +- DxSound.cpp | 332 +++++++++++++++++++++- DxSound.h | 4 +- DxSoundConvert.cpp | 4 +- DxSoundConvert.h | 2 +- DxStatic.h | 22 +- DxSystem.cpp | 2 +- DxSystem.h | 2 +- DxThread.cpp | 2 +- DxThread.h | 2 +- DxUseCLib.cpp | 2 +- DxUseCLib.h | 2 +- DxUseCLibLive2DCubism4.cpp | 2 +- DxUseCLibLive2DCubism4.h | 2 +- DxUseCLibOgg.cpp | 129 ++++++++- DxUseCLibOgg.h | 9 +- DxUseCLibPhysics.cpp | 2 +- 94 files changed, 1647 insertions(+), 383 deletions(-) diff --git a/DxASyncLoad.cpp b/DxASyncLoad.cpp index 6b91254..b9c6c66 100644 --- a/DxASyncLoad.cpp +++ b/DxASyncLoad.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 非同期読み込み処理プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxASyncLoad.h b/DxASyncLoad.h index e65ac26..df9723d 100644 --- a/DxASyncLoad.h +++ b/DxASyncLoad.h @@ -2,7 +2,7 @@ // // DXライブラリ 非同期読み込み処理プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxArchive_.cpp b/DxArchive_.cpp index b35c7c9..23d14bf 100644 --- a/DxArchive_.cpp +++ b/DxArchive_.cpp @@ -2,7 +2,7 @@ // // DXライブラリ アーカイブ制御プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxArchive_.h b/DxArchive_.h index 1848cec..74f9f6f 100644 --- a/DxArchive_.h +++ b/DxArchive_.h @@ -2,7 +2,7 @@ // // DXライブラリ 通信プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxBaseFunc.cpp b/DxBaseFunc.cpp index ceda152..f5d4d31 100644 --- a/DxBaseFunc.cpp +++ b/DxBaseFunc.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 標準関数の互換関数プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxBaseFunc.h b/DxBaseFunc.h index 96e7a0b..b279680 100644 --- a/DxBaseFunc.h +++ b/DxBaseFunc.h @@ -2,7 +2,7 @@ // // DXライブラリ 標準関数の互換関数プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxBaseImage.cpp b/DxBaseImage.cpp index ad938e6..1a15e24 100644 --- a/DxBaseImage.cpp +++ b/DxBaseImage.cpp @@ -2,7 +2,7 @@ // // DXライブラリ BaseImageプログラム // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- @@ -3424,6 +3424,13 @@ static int LoadBmpImage( STREAMDATA *Stream, BASEIMAGE *BaseImage, int GetFormat Format = 888 ; } else + if( ( ( DWORD * )BmpInfo2->bmiColors )[ 0 ] == 0x00ff0000 && + ( ( DWORD * )BmpInfo2->bmiColors )[ 1 ] == 0x0000ff00 && + ( ( DWORD * )BmpInfo2->bmiColors )[ 2 ] == 0x000000ff ) + { + Format = 1888 ; + } + else if( ( ( DWORD * )BmpInfo2->bmiColors )[ 0 ] == 0x0000f800 && ( ( DWORD * )BmpInfo2->bmiColors )[ 1 ] == 0x000007e0 && ( ( DWORD * )BmpInfo2->bmiColors )[ 2 ] == 0x0000001f ) @@ -3437,10 +3444,6 @@ static int LoadBmpImage( STREAMDATA *Stream, BASEIMAGE *BaseImage, int GetFormat { Format = 555 ; } - else - { - Format = 555 ; - } if( Format != -1 ) { @@ -3481,6 +3484,27 @@ static int LoadBmpImage( STREAMDATA *Stream, BASEIMAGE *BaseImage, int GetFormat NS_CreateXRGB8ColorData( &BaseImage->ColorData ) ; switch( Format ) { + case 1888 : + BaseImage->ColorData.ColorBitDepth = 32 ; + BaseImage->ColorData.PixelByte = 4 ; + + BaseImage->ColorData.NoneLoc = 24 ; + BaseImage->ColorData.NoneMask = 0xff000000 ; + BaseImage->ColorData.NoneWidth = 8 ; + + BaseImage->ColorData.RedLoc = 16 ; + BaseImage->ColorData.RedMask = 0x00ff0000 ; + BaseImage->ColorData.RedWidth = 8 ; + + BaseImage->ColorData.GreenLoc = 8 ; + BaseImage->ColorData.GreenMask = 0x0000ff00 ; + BaseImage->ColorData.GreenWidth = 8 ; + + BaseImage->ColorData.BlueLoc = 0 ; + BaseImage->ColorData.BlueMask = 0x000000ff ; + BaseImage->ColorData.BlueWidth = 8 ; + break ; + case 888 : BaseImage->ColorData.ColorBitDepth = 32 ; BaseImage->ColorData.PixelByte = 4 ; @@ -6663,25 +6687,25 @@ extern int NS_GetDesktopScreenBaseImage( int x1, int y1, int x2, int y2, BASEIMA DesktopW = DesktopRect.right - DesktopRect.left ; DesktopH = DesktopRect.bottom - DesktopRect.top ; - // 指定の矩形の補正 - if( x1 < DesktopRect.left ) - { - DestX += DesktopRect.left - x1 ; - x1 = DesktopRect.left ; - } - if( y1 < DesktopRect.top ) - { - DestY += DesktopRect.top - y1 ; - y1 = DesktopRect.top ; - } - if( x2 > DesktopRect.right ) - { - x2 = DesktopRect.right ; - } - if( y2 > DesktopRect.bottom ) - { - y2 = DesktopRect.bottom ; - } +// // 指定の矩形の補正 +// if( x1 < DesktopRect.left ) +// { +// DestX += DesktopRect.left - x1 ; +// x1 = DesktopRect.left ; +// } +// if( y1 < DesktopRect.top ) +// { +// DestY += DesktopRect.top - y1 ; +// y1 = DesktopRect.top ; +// } +// if( x2 > DesktopRect.right ) +// { +// x2 = DesktopRect.right ; +// } +// if( y2 > DesktopRect.bottom ) +// { +// y2 = DesktopRect.bottom ; +// } // 取り込みサイズの算出 CaptureW = x2 - x1 ; diff --git a/DxBaseImage.h b/DxBaseImage.h index 4c18d21..cd87b19 100644 --- a/DxBaseImage.h +++ b/DxBaseImage.h @@ -2,7 +2,7 @@ // // DXライブラリ BaseImageプログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxChar.cpp b/DxChar.cpp index 44a90a5..d6cbbce 100644 --- a/DxChar.cpp +++ b/DxChar.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 文字コード関係プログラム // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- diff --git a/DxChar.h b/DxChar.h index 967806a..7f8f369 100644 --- a/DxChar.h +++ b/DxChar.h @@ -2,7 +2,7 @@ // // DXライブラリ 文字コード関係プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxCharCodeTable.cpp b/DxCharCodeTable.cpp index 8a78169..33caa03 100644 --- a/DxCharCodeTable.cpp +++ b/DxCharCodeTable.cpp @@ -2,7 +2,7 @@ // // DXライブラリ キャラクタコードテーブル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxCompileConfig.h b/DxCompileConfig.h index 46b4569..a024140 100644 --- a/DxCompileConfig.h +++ b/DxCompileConfig.h @@ -2,7 +2,7 @@ // // DXライブラリ コンパイルコンフィグヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- diff --git a/DxDataType.h b/DxDataType.h index 4b9bdca..a711127 100644 --- a/DxDataType.h +++ b/DxDataType.h @@ -2,7 +2,7 @@ // // DXライブラリ データタイプ定義ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxDataTypeAndroid.h b/DxDataTypeAndroid.h index 6b1c886..8f7b1fa 100644 --- a/DxDataTypeAndroid.h +++ b/DxDataTypeAndroid.h @@ -2,7 +2,7 @@ // // DXライブラリ Nintendo Switch用データタイプ定義ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxDataTypeHTML5.h b/DxDataTypeHTML5.h index 052d493..6047e0c 100644 --- a/DxDataTypeHTML5.h +++ b/DxDataTypeHTML5.h @@ -2,7 +2,7 @@ // // シ、シク繝ゥ繧、繝悶Λ繝ェ HTML5逕ィ繝繝シ繧ソ繧ソ繧、繝怜ョ夂セゥ繝倥ャ繝繝輔ぃ繧、繝ォ // -// Ver 3.21d +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxDataTypeWin.h b/DxDataTypeWin.h index 81cc40f..c5d5a36 100644 --- a/DxDataTypeWin.h +++ b/DxDataTypeWin.h @@ -2,7 +2,7 @@ // // DXライブラリ Windows用データタイプ定義ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxDataTypeiOS.h b/DxDataTypeiOS.h index c437748..562b9c3 100644 --- a/DxDataTypeiOS.h +++ b/DxDataTypeiOS.h @@ -2,7 +2,7 @@ // // DXライブラリ iOS用データタイプ定義ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxFile.cpp b/DxFile.cpp index 42e67cb..548ac46 100644 --- a/DxFile.cpp +++ b/DxFile.cpp @@ -2,7 +2,7 @@ // // DXライブラリ ファイルアクセスプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxFile.h b/DxFile.h index b5d4638..8adabde 100644 --- a/DxFile.h +++ b/DxFile.h @@ -2,7 +2,7 @@ // // DXライブラリ ファイルアクセスプログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxFont.cpp b/DxFont.cpp index ddb641f..3b951d0 100644 --- a/DxFont.cpp +++ b/DxFont.cpp @@ -2,7 +2,7 @@ // // DXライブラリ DirectDraw制御プログラム // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- @@ -2827,9 +2827,6 @@ extern int FontCacheCharImageBltToHandle( RGBMask = cl.RedMask | cl.GreenMask | cl.BlueMask ; - // printf("Font Init: Overhere? (SrcPitch=%d, DestPitch=%d)\n", ImagePitch, DestPitch); - // printf("Cache Info: PixelByte=%d, BitWidth=%d\n", ManageData->TextureCacheBaseImage.ColorData.PixelByte, ManageData->TextureCacheBaseImage.ColorData.ColorBitDepth); - switch( ImageType ) { case DX_FONT_SRCIMAGETYPE_1BIT : @@ -3337,8 +3334,6 @@ extern int FontCacheCharImageBltToHandle( { if( BaseImage.ColorData.MaxPaletteNo == 15 ) { - // printf("Font Init: Overhere 1?\n"); - for( i = 0 ; i < Height ; i ++ ) { for( j = 0 ; j < Width ; j ++ ) @@ -3352,8 +3347,6 @@ extern int FontCacheCharImageBltToHandle( } else { - // printf("Font Init: Overhere 2?\n"); - for( i = 0 ; i < Height ; i ++ ) { for( j = 0 ; j < Width ; j ++ ) @@ -3372,8 +3365,6 @@ extern int FontCacheCharImageBltToHandle( { BYTE aloc, rloc, gloc, bloc ; - // printf("Font Init: Overhere 3?\n"); - aloc = ( BYTE )( cl.AlphaLoc + cl.AlphaWidth - 8 ) ; rloc = ( BYTE )( cl.RedLoc + cl.RedWidth - 8 ) ; gloc = ( BYTE )( cl.GreenLoc + cl.GreenWidth - 8 ) ; @@ -3391,8 +3382,6 @@ extern int FontCacheCharImageBltToHandle( } else { - // printf("Font Init: Overhere 4?\n"); - for( i = 0 ; i < Height ; i ++ ) { for( j = 0 ; j < Width ; j ++ ) @@ -3412,7 +3401,6 @@ extern int FontCacheCharImageBltToHandle( } #ifndef DX_NON_GRAPHICS - // テクスチャキャッシュに転送 if( TextureCacheUpdate ) { @@ -3457,7 +3445,7 @@ extern int FontCacheCharImageBltToHandle( int EdgeSize ; int DestPitch ; unsigned char ( *EdgePat )[ FONTEDGE_PATTERN_NUM * 2 + 1 ] ; - + Width = ( int )CharData->SizeX ; Height = ( int )CharData->SizeY ; @@ -5395,7 +5383,6 @@ extern int FontTextureCacheUpdateRectApply( FONTMANAGE *ManageData ) ManageData->TextureCacheUpdateRectValid = FALSE ; - Graphics_Image_BltBmpOrGraphImageToGraph2Base( &ManageData->TextureCacheBaseImage, NULL, &ManageData->TextureCacheUpdateRect, @@ -6626,7 +6613,7 @@ static int LoadFontDataFromMemToHandle_UseGParam_Static( ManageData->FontDataFile.CharaTable = ( FONTDATAFILECHARADATA ** )( ( BYTE * )ManageData->FontDataFile.CharaTable + ( sizeof( FONTBASEINFO ) - DX_FONTBASEINFO_SIZE_VER0 ) ) ; } - // フォントデータファイル??の 0xffff を超える文字コードの文字情報へのアドレスの配列を保存するメモリ領域へのアドレスをセット + // フォントデータファイル内の 0xffff を超える文字コードの文字情報へのアドレスの配列を保存するメモリ領域へのアドレスをセット ManageData->FontDataFile.CharaExArray = ManageData->FontDataFile.CharaTable + 0x10000 ; // 解凍したフォント画像データを格納するメモリアドレスをセット @@ -10935,7 +10922,7 @@ LOOPEND : MaxDrawPos = DrawPos ; } } - DrawPosSub += ( UseManageData->BaseInfo.FontHeight - UseManageData->BaseInfo.FontAddHeight ) * ExRate ; + DrawPosSub += ( UseManageData->BaseInfo.FontHeight - UseManageData->BaseInfo.FontAddHeight ) * ( VerticalFlag ? ExRateX : ExRateY ) ; // 縁なしの場合は最後に描画輝度を元に戻す Graphics_DrawSetting_SetDrawBrightToOneParam( OrigColor ) ; @@ -11144,7 +11131,7 @@ LOOPEND : MaxDrawPos = DrawPos ; } } - DrawPosSub += ( UseManageData->BaseInfo.FontHeight - UseManageData->BaseInfo.FontAddHeight ) * ExRate ; + DrawPosSub += ( UseManageData->BaseInfo.FontHeight - UseManageData->BaseInfo.FontAddHeight ) * ( VerticalFlag ? ExRateX : ExRateY ) ; } if( DrawSize != NULL ) @@ -12501,7 +12488,7 @@ extern int NS_FontBaseImageBltToHandle( int x, int y, const TCHAR *StrData, BASE #endif } -// 基本イメー??に文字列を描画する +// 基本イメージに文字列を描画する extern int NS_FontBaseImageBltToHandleWithStrLen( int x, int y, const TCHAR *StrData, size_t StrDataLength, BASEIMAGE *DestImage, BASEIMAGE *DestEdgeImage, int FontHandle, int VerticalFlag ) { int Result ; @@ -14312,14 +14299,14 @@ extern int DrawVStringF_WCHAR_T( float x, float y, const wchar_t *String, size_t if( VerticalFlag )\ {\ x += font->BaseInfo.FontAddHeight / 2;\ - SETRECT( DrawRect, x, y, x + NS_GetFontSizeToHandle( FontHandle ) + 3, GSYS.DrawSetting.DrawArea.bottom ) ;\ + SETRECT( DrawRect, x, y, x + NS_GetFontSizeToHandle( FontHandle ) + font->BaseInfo.FontAddHeight / 2 + 3, GSYS.DrawSetting.DrawArea.bottom ) ;\ if( DrawRect.left >= GSYS.DrawSetting.DrawArea.right ) return 0 ;\ x -= font->BaseInfo.FontAddHeight / 2;\ }\ else\ {\ y -= font->BaseInfo.FontAddHeight / 2 ;\ - SETRECT( DrawRect, x, y, GSYS.DrawSetting.DrawArea.right, y + NS_GetFontSizeToHandle( FontHandle ) + 3 ) ;\ + SETRECT( DrawRect, x, y, GSYS.DrawSetting.DrawArea.right, y + NS_GetFontSizeToHandle( FontHandle ) + font->BaseInfo.FontAddHeight / 2 + 3 ) ;\ if( DrawRect.left >= GSYS.DrawSetting.DrawArea.right ) return 0 ;\ y += font->BaseInfo.FontAddHeight / 2 ;\ }\ diff --git a/DxFont.h b/DxFont.h index 719be71..f94e70a 100644 --- a/DxFont.h +++ b/DxFont.h @@ -2,7 +2,7 @@ // // DXライブラリ フォント処理用プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxFunctionAndroid.h b/DxFunctionAndroid.h index ea5f30b..cf17a2c 100644 --- a/DxFunctionAndroid.h +++ b/DxFunctionAndroid.h @@ -2,7 +2,7 @@ // // DXライブラリ Android専用関数プロトタイプ宣言用ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxFunctionWin.h b/DxFunctionWin.h index 5128835..5549f78 100644 --- a/DxFunctionWin.h +++ b/DxFunctionWin.h @@ -2,7 +2,7 @@ // // DXライブラリ Windows専用関数プロトタイプ宣言用ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -57,6 +57,7 @@ namespace DxLib extern int GetWindowEdgeWidth( int *LeftWidth, int *RightWidth, int *TopWidth, int *BottomWidth ) ; // ウインドウの上下左右の縁の幅を取得する extern int GetWindowPosition( int *x, int *y ) ; // メインウインドウのデスクトップ上の左上端座標を取得する( 枠も含める ) extern int GetWindowUserCloseFlag( int StateResetFlag = FALSE ) ; // メインウインドウの閉じるボタンが押されたかどうかを取得する +extern int CheckWindowMaximizeButtonInput( int StateResetFlag = TRUE ) ; // メインウインドウの最大化ボタンが押されたかどうかを取得する、SetWindowMaximizeButtonBehavior( 1 ); が実行されている場合のみ有効な関数( StateResetFlag TRUE = 押された状態をリセットする FALSE = 押された状態をリセットしない ) extern int GetNotDrawFlag( void ) ; // DXライブラリの描画機能を使うかどうかの設定を取得する extern int GetPaintMessageFlag( void ) ; // WM_PAINT メッセージが来たかどうかを取得する(戻り値 TRUE:WM_PAINTメッセージが来た(一度取得すると以後、再び WM_PAINTメッセージが来るまで FALSE が返ってくるようになる) FALSE:WM_PAINT メッセージは来ていない) extern int GetValidHiPerformanceCounter( void ) ; // パフォーマンスカウンタが有効かどうかを取得する(戻り値 TRUE:有効 FALSE:無効) @@ -89,6 +90,7 @@ namespace DxLib extern int SetWindowPosition( int x, int y ) ; // メインウインドウの位置を設定する( 枠も含めた左上座標 ) extern int SetSysCommandOffFlag( int Flag , const TCHAR *HookDllPath = NULL ) ; // タスクスイッチを有効にするかどうかを設定する extern int SetSysCommandOffFlagWithStrLen( int Flag , const TCHAR *HookDllPath = NULL , size_t HookDllPathLength = 0 ) ; // タスクスイッチを有効にするかどうかを設定する +extern int SetWindowMaximizeButtonBehavior( int BehaviorType ) ; // メインウインドウの最大化ボタンが押されたときの挙動を設定する( BehaviorType 0=標準動作 1=標準動作は行わず、最大化ボタンが押されたかどうかは CheckWindowMaximizeButtonInput で判定する ) extern int SetHookWinProc( WNDPROC WinProc ) ; // メインウインドウへのメッセージをフックするウインドウプロージャを登録する extern int SetUseHookWinProcReturnValue( int UseFlag ) ; // SetHookWinProc で設定したウインドウプロージャの戻り値を使用するかどうかを設定する、SetHookWinProc で設定したウインドウプロージャの中でのみ使用可能( UseFlag TRUE:戻り値を使用して、DXライブラリのウインドウプロージャの処理は行わない FALSE:戻り値は使用せず、ウインドウプロージャから出た後、DXライブラリのウインドウプロージャの処理を行う ) extern int SetDoubleStartValidFlag( int Flag ) ; // DXライブラリを使用したソフトの二重起動を可能にするかどうかの設定を行う( TRUE:可能にする FALSE:不可能にする( デフォルト ) ) @@ -319,6 +321,7 @@ namespace DxLib extern int SetUseDirect3DVersion( int Version /* DX_DIRECT3D_9 など */ ) ; // 使用する Direct3D のバージョンを設定する、DxLib_Init 呼び出しの前でのみ使用可能  extern int GetUseDirect3DVersion( void ) ; // 使用している Direct3D のバージョンを取得する( DX_DIRECT3D_9 など ) extern int GetUseDirect3D11FeatureLevel( void ) ; // 使用している Direct3D11 の FeatureLevel ( DX_DIRECT3D_11_FEATURE_LEVEL_9_1 等 )を取得する( 戻り値 -1:エラー -1以外:Feature Level ) +extern int SetUseDirect3D11AdapterIndex( int Index ) ; // 使用するグラフィックスデバイスのアダプターのインデックスを設定する extern int SetUseDirectDrawFlag( int Flag ) ; // ( 同効果のSetUseSoftwareRenderModeFlag を使用して下さい )DirectDrawを使用するかどうかを設定する extern int SetUseGDIFlag( int Flag ) ; // GDI描画を使用するかどうかを設定する extern int GetUseGDIFlag( void ) ; // GDI描画を使用するかどうかを取得する diff --git a/DxFunctioniOS.h b/DxFunctioniOS.h index 3d3db1e..00e2ef7 100644 --- a/DxFunctioniOS.h +++ b/DxFunctioniOS.h @@ -2,7 +2,7 @@ // // シ、シク繝ゥ繧、繝悶Λ繝ェ iOS蟆ら畑髢「謨ー繝励Ο繝医ち繧、繝怜ョ」險逕ィ繝倥ャ繝繝輔ぃ繧、繝ォ // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxGateway.cpp b/DxGateway.cpp index 5dc1581..2b2bcac 100644 --- a/DxGateway.cpp +++ b/DxGateway.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 内部との出入り口プログラムファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -1438,6 +1438,14 @@ extern int GetWindowUserCloseFlag( int StateResetFlag ) DXFUNC_END return Result ; } +extern int CheckWindowMaximizeButtonInput( int StateResetFlag ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_CheckWindowMaximizeButtonInput( StateResetFlag ) ; + DXFUNC_END + return Result ; +} extern int GetNotDrawFlag( void ) { int Result ; @@ -1734,6 +1742,14 @@ extern int SetSysCommandOffFlagWithStrLen( int Flag , const TCHAR *HookDllPath, DXFUNC_END return Result ; } +extern int SetWindowMaximizeButtonBehavior( int BehaviorType ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_SetWindowMaximizeButtonBehavior( BehaviorType ) ; + DXFUNC_END + return Result ; +} extern int SetHookWinProc( WNDPROC WinProc ) { int Result ; @@ -8412,6 +8428,15 @@ extern int UpdateShaderConstantBuffer( int SConstBufHandle ) #ifndef DX_NON_FILTER +extern int SetGraphFilterBltBlendMode( int BlendMode /* DX_BLENDMODE_ALPHA など */ ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_SetGraphFilterBltBlendMode( BlendMode ) ; + DXFUNC_END + return Result ; +} + extern int GraphFilter( int GrHandle, int FilterType /* DX_BLTFILTER_GAUSS_H 等 */ , ... ) { int Result ; @@ -9385,6 +9410,14 @@ extern int GetUseDirect3D11FeatureLevel( void ) DXFUNC_END return Result ; } +extern int SetUseDirect3D11AdapterIndex( int Index ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_SetUseDirect3D11AdapterIndex( Index ) ; + DXFUNC_END + return Result ; +} extern int SetUseDirectDrawFlag( int Flag ) { return NS_SetUseDirectDrawFlag( Flag ) ; @@ -16220,6 +16253,40 @@ extern int GetMP3TagInfoWithStrLen( const TCHAR *FileName, size_t FileNameLength DXFUNC_END return Result ; } +#ifndef DX_NON_OGGVORBIS +extern int GetOggCommentNum( const TCHAR *FileName ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_GetOggCommentNum( FileName ) ; + DXFUNC_END + return Result ; +} +extern int GetOggCommentNumWithStrLen( const TCHAR *FileName, size_t FileNameLength ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_GetOggCommentNumWithStrLen( FileName, FileNameLength ) ; + DXFUNC_END + return Result ; +} +extern int GetOggComment( const TCHAR *FileName, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_GetOggComment( FileName, CommentIndex, CommentNameBuffer, CommentNameBufferBytes, CommentBuffer, CommentBufferBytes ) ; + DXFUNC_END + return Result ; +} +extern int GetOggCommentWithStrLen( const TCHAR *FileName, size_t FileNameLength, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_GetOggCommentWithStrLen( FileName, FileNameLength, CommentIndex, CommentNameBuffer, CommentNameBufferBytes, CommentBuffer, CommentBufferBytes ) ; + DXFUNC_END + return Result ; +} +#endif // DX_NON_OGGVORBIS // 設定関係関数 @@ -18662,6 +18729,24 @@ extern int MV1GetMaterialDifMapTexture( int MHandle, int MaterialIndex ) return Result ; } +extern int MV1SetMaterialSubDifMapTexture( int MHandle, int MaterialIndex, int TexIndex ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_MV1SetMaterialSubDifMapTexture( MHandle, MaterialIndex, TexIndex ) ; + DXFUNC_END + return Result ; +} + +extern int MV1GetMaterialSubDifMapTexture( int MHandle, int MaterialIndex ) +{ + int Result ; + DXFUNC_BEGIN + Result = NS_MV1GetMaterialSubDifMapTexture( MHandle, MaterialIndex ) ; + DXFUNC_END + return Result ; +} + extern int MV1SetMaterialSpcMapTexture( int MHandle, int MaterialIndex, int TexIndex ) { int Result ; diff --git a/DxGraphics.cpp b/DxGraphics.cpp index ad91905..08afe24 100644 --- a/DxGraphics.cpp +++ b/DxGraphics.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 描画プログラム // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- @@ -10700,6 +10700,14 @@ extern int NS_DrawCube3DD( VECTOR_D Pos1, VECTOR_D Pos2, unsigned int DifColor, NS_GetColor2( DifColor, &dr, &dg, &db ) ; NS_GetColor2( SpcColor, &sr, &sg, &sb ) ; a = GSYS.DrawSetting.BlendMode == DX_BLENDMODE_NOBLEND ? 255 : GSYS.DrawSetting.BlendParam ; + Vertex[ 0 ].norm.x = -0.57735027f ; Vertex[ 0 ].norm.y = 0.57735027f ; Vertex[ 0 ].norm.z = 0.57735027f ; + Vertex[ 1 ].norm.x = 0.57735027f ; Vertex[ 1 ].norm.y = 0.57735027f ; Vertex[ 1 ].norm.z = 0.57735027f ; + Vertex[ 2 ].norm.x = 0.57735027f ; Vertex[ 2 ].norm.y = 0.57735027f ; Vertex[ 2 ].norm.z = -0.57735027f ; + Vertex[ 3 ].norm.x = -0.57735027f ; Vertex[ 3 ].norm.y = 0.57735027f ; Vertex[ 3 ].norm.z = -0.57735027f ; + Vertex[ 4 ].norm.x = -0.57735027f ; Vertex[ 4 ].norm.y = -0.57735027f ; Vertex[ 4 ].norm.z = 0.57735027f ; + Vertex[ 5 ].norm.x = 0.57735027f ; Vertex[ 5 ].norm.y = -0.57735027f ; Vertex[ 5 ].norm.z = 0.57735027f ; + Vertex[ 6 ].norm.x = 0.57735027f ; Vertex[ 6 ].norm.y = -0.57735027f ; Vertex[ 6 ].norm.z = -0.57735027f ; + Vertex[ 7 ].norm.x = -0.57735027f ; Vertex[ 7 ].norm.y = -0.57735027f ; Vertex[ 7 ].norm.z = -0.57735027f ; Vertex[ 0 ].pos.x = Pos1F.x ; Vertex[ 0 ].pos.y = Pos2F.y ; Vertex[ 0 ].pos.z = Pos2F.z ; Vertex[ 1 ].pos.x = Pos2F.x ; Vertex[ 1 ].pos.y = Pos2F.y ; Vertex[ 1 ].pos.z = Pos2F.z ; Vertex[ 2 ].pos.x = Pos2F.x ; Vertex[ 2 ].pos.y = Pos2F.y ; Vertex[ 2 ].pos.z = Pos1F.z ; @@ -10981,16 +10989,14 @@ extern int NS_DrawCubeSet3D( CUBEDATA *CubeDataArray, int Num, int FillFlag ) Vertex = GSYS.Resource.DrawCubeSet3DWorkVertexBuffer[ 0 ] ; for( i = 0 ; i < GSYS.Resource.DrawCubeSet3DWorkVertexBufferSize[ 0 ] ; i ++ ) { - Vertex[ 0 ].norm.x = 0.0f ; - Vertex[ 0 ].norm.y = 0.0f ; - Vertex[ 0 ].norm.z = 0.0f ; - Vertex[ 1 ].norm = Vertex[ 0 ].norm ; - Vertex[ 2 ].norm = Vertex[ 0 ].norm ; - Vertex[ 3 ].norm = Vertex[ 0 ].norm ; - Vertex[ 4 ].norm = Vertex[ 0 ].norm ; - Vertex[ 5 ].norm = Vertex[ 0 ].norm ; - Vertex[ 6 ].norm = Vertex[ 0 ].norm ; - Vertex[ 7 ].norm = Vertex[ 0 ].norm ; + Vertex[ 0 ].norm.x = -0.57735027f ; Vertex[ 0 ].norm.y = 0.57735027f ; Vertex[ 0 ].norm.z = 0.57735027f ; + Vertex[ 1 ].norm.x = 0.57735027f ; Vertex[ 1 ].norm.y = 0.57735027f ; Vertex[ 1 ].norm.z = 0.57735027f ; + Vertex[ 2 ].norm.x = 0.57735027f ; Vertex[ 2 ].norm.y = 0.57735027f ; Vertex[ 2 ].norm.z = -0.57735027f ; + Vertex[ 3 ].norm.x = -0.57735027f ; Vertex[ 3 ].norm.y = 0.57735027f ; Vertex[ 3 ].norm.z = -0.57735027f ; + Vertex[ 4 ].norm.x = -0.57735027f ; Vertex[ 4 ].norm.y = -0.57735027f ; Vertex[ 4 ].norm.z = 0.57735027f ; + Vertex[ 5 ].norm.x = 0.57735027f ; Vertex[ 5 ].norm.y = -0.57735027f ; Vertex[ 5 ].norm.z = 0.57735027f ; + Vertex[ 6 ].norm.x = 0.57735027f ; Vertex[ 6 ].norm.y = -0.57735027f ; Vertex[ 6 ].norm.z = -0.57735027f ; + Vertex[ 7 ].norm.x = -0.57735027f ; Vertex[ 7 ].norm.y = -0.57735027f ; Vertex[ 7 ].norm.z = -0.57735027f ; Vertex[ 0 ].u = 0.0f ; Vertex[ 0 ].v = 0.0f ; Vertex[ 0 ].su = 0.0f ; Vertex[ 0 ].sv = 0.0f ; Vertex[ 1 ].u = 0.0f ; Vertex[ 1 ].v = 0.0f ; Vertex[ 1 ].su = 0.0f ; Vertex[ 1 ].sv = 0.0f ; Vertex[ 2 ].u = 0.0f ; Vertex[ 2 ].v = 0.0f ; Vertex[ 2 ].su = 0.0f ; Vertex[ 2 ].sv = 0.0f ; @@ -11132,7 +11138,7 @@ extern int NS_DrawCubeSet3D( CUBEDATA *CubeDataArray, int Num, int FillFlag ) { NS_DrawPrimitiveIndexed3D( GSYS.Resource.DrawCubeSet3DWorkVertexBuffer[ 0 ], 8 * j, - GSYS.Resource.DrawCubeSet3DWorkIndexBuffer[ 0 ], 24 * j, + GSYS.Resource.DrawCubeSet3DWorkIndexBuffer[ 2 ], 24 * j, DX_PRIMTYPE_LINELIST, DX_NONE_GRAPH, TRUE ) ; } @@ -11159,7 +11165,7 @@ extern int NS_DrawCubeSet3D( CUBEDATA *CubeDataArray, int Num, int FillFlag ) { NS_DrawPrimitiveIndexed3D( GSYS.Resource.DrawCubeSet3DWorkVertexBuffer[ 0 ], 8 * j, - GSYS.Resource.DrawCubeSet3DWorkIndexBuffer[ 0 ], 24 * j, + GSYS.Resource.DrawCubeSet3DWorkIndexBuffer[ 2 ], 24 * j, DX_PRIMTYPE_LINELIST, DX_NONE_GRAPH, TRUE ) ; } } @@ -18300,7 +18306,7 @@ extern int NS_SetDrawScreen( int DrawScreen ) { return -1 ; } - + // 今までの画面が表画面だった場合は一度 ScreenCopy を行う if( ( DWORD )GSYS.DrawSetting.TargetScreen[ 0 ] == DX_SCREEN_FRONT ) { @@ -18334,7 +18340,7 @@ extern int NS_SetDrawScreen( int DrawScreen ) GSYS.DrawSetting.TargetScreen[ 0 ] = DrawScreen ; GSYS.DrawSetting.TargetScreenSurface[ 0 ] = 0 ; GSYS.DrawSetting.TargetScreenMipLevel[ 0 ] = 0 ; - + // 描画可能サイズの取得 NS_GetGraphSize( DrawScreen, &GSYS.DrawSetting.DrawSizeX, &GSYS.DrawSetting.DrawSizeY ) ; @@ -32976,7 +32982,7 @@ extern int Graphics_Draw_GetOval_ThicknessDrawPosition( int x, int y, int rx, in if( ix < MinX ) MinX = ix ; if( iy < MinY ) MinY = iy ;\ }\ \ - SETRECT( DrawRect, MinX, MinY, MaxX, MaxY ) ;\ + SETRECT( DrawRect, MinX - 1, MinY - 1, MaxX + 1, MaxY + 1 ) ;\ extern int Graphics_Draw_DrawSimpleQuadrangleGraphF( const GRAPHICS_DRAW_DRAWSIMPLEQUADRANGLEGRAPHF_PARAM *Param ) { @@ -33046,23 +33052,22 @@ extern int Graphics_Draw_DrawSimpleQuadrangleGraphF( const GRAPHICS_DRAW_DRAWSIM // 座標補正を行わない1ポリゴン描画を行う( 1テクスチャ画像のみ有効 ) #define SETDRAWRECTCODE\ - int x[ 3 ], y[ 3 ], MaxX, MaxY, MinX, MinY ;\ + int MaxX, MaxY, MinX, MinY ;\ int i, ix, iy ;\ -\ - x[ 0 ] = _FTOL( Param->Vertex[ 0 ].x ) ; x[ 1 ] = _FTOL( Param->Vertex[ 1 ].x ) ; x[ 2 ] = _FTOL( Param->Vertex[ 2 ].x ) ;\ - y[ 0 ] = _FTOL( Param->Vertex[ 0 ].y ) ; y[ 1 ] = _FTOL( Param->Vertex[ 1 ].y ) ; y[ 2 ] = _FTOL( Param->Vertex[ 2 ].y ) ;\ + int VertexNum = Param->TriangleNum * 3 ;\ \ MaxX = 0 ; MaxY = 0 ;\ MinX = 0xfffffff ; MinY = 0xfffffff ;\ \ - for( i = 0 ; i < 3 ; i ++ )\ + for( i = 0 ; i < VertexNum ; i ++ )\ {\ - ix = x[ i ] ; iy = y[ i ] ;\ + ix = _FTOL( Param->Vertex[ i ].x ) ;\ + iy = _FTOL( Param->Vertex[ i ].y ) ;\ if( ix > MaxX ) MaxX = ix ; if( iy > MaxY ) MaxY = iy ;\ if( ix < MinX ) MinX = ix ; if( iy < MinY ) MinY = iy ;\ }\ \ - SETRECT( DrawRect, MinX, MinY, MaxX, MaxY ) ;\ + SETRECT( DrawRect, MinX - 1, MinY - 1, MaxX + 1, MaxY + 1 ) ;\ extern int Graphics_Draw_DrawSimpleTriangleGraphF( const GRAPHICS_DRAW_DRAWSIMPLETRIANGLEGRAPHF_PARAM *Param ) { diff --git a/DxGraphics.h b/DxGraphics.h index 60ad941..0684c40 100644 --- a/DxGraphics.h +++ b/DxGraphics.h @@ -2,7 +2,7 @@ // // DXライブラリ 描画プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -1576,6 +1576,7 @@ extern void FASTCALL Graphics_DrawSetting_BlendModeSub_Post( RECT *DrawRect ) ; extern int Graphics_Hardware_SetUseOldDrawModiGraphCodeFlag_PF( int Flag ) ; // 以前の DrawModiGraph 関数のコードを使用するかどうかのフラグをセットする extern int Graphics_Hardware_RefreshAlphaChDrawMode_PF( void ) ; // 描画先に正しいα値を書き込むかどうかのフラグを更新する //extern void Graphics_Hardware_SetUse2DProjectionMatrix_PF( int Use2DProjectionMatrix ) ; // 使用する射影行列を3D用にするか2D用にするかを設定する +extern int Graphics_Hardware_RefreshSetting_PF( void ) ; // ミドルウェア等を使用した後に Direct3D や OpenGL のDXライブラリ用の設定を再度行うための関数 diff --git a/DxGraphicsFilter.cpp b/DxGraphicsFilter.cpp index bffd59f..79f8208 100644 --- a/DxGraphicsFilter.cpp +++ b/DxGraphicsFilter.cpp @@ -2,7 +2,7 @@ // // DXライブラリ GraphFilter系プログラム // -// Ver 3.21f +// Ver 3.22a // //----------------------------------------------------------------------------- @@ -33,6 +33,9 @@ #endif // TARGET_OS_IPHONE #endif // __APPLE__ +#ifdef EMSCRIPTEM +#include "HTML5/DxGraphicsFilterHTML5.h" +#endif @@ -50,6 +53,7 @@ namespace DxLib // データ定義 ----------------------------------------------------------------- GRAPHFILTER_SHADER_HANDLE GraphFilterShaderHandle ; +GRAPHFILTER_SYSTEM_DATA GraphFilterSystemData ; // 関数宣言 ------------------------------------------------------------------- @@ -82,6 +86,22 @@ extern int GraphFilter_Terminate( void ) return 0 ; } +// GraphFilterBlt や GraphBlendBlt の結果を転送先に転送する際のブレンドモードを設定する( 現状で対応しているのは DX_BLENDMODE_NOBLEND と DX_BLENDMODE_ALPHA のみ ) +extern int NS_SetGraphFilterBltBlendMode( int BlendMode /* DX_BLENDMODE_ALPHA など */ ) +{ + // 未対応のブレンドモードの場合はエラー + if( BlendMode != DX_BLENDMODE_ALPHA && BlendMode != DX_BLENDMODE_NOBLEND ) + { + return -1 ; + } + + // ブレンドモードを保存 + GraphFilterSystemData.BltBlendMode = BlendMode ; + + // 終了 + return 0 ; +} + // 画像にフィルター処理を行う extern int NS_GraphFilter( int GrHandle, int FilterType /* DX_GRAPH_FILTER_GAUSS_H 等 */ , ... ) { @@ -190,14 +210,14 @@ static int GraphFilter_GetSoftImage( int GrHandle, BASEIMAGE *BaseImage, RECT *G RECT TempRect ; int Width, Height ; BASEIMAGE SurfaceImage ; - IMAGEDATA *Image ; + IMAGEDATA *Image = NULL ; IMAGEDATA_HARD_DRAW *HardDraw ; RECT SrcRect ; RECT DestRect ; int i ; int temp ; - if( GRAPHCHK( GrHandle, Image ) ) + if( GrHandle != DX_SCREEN_BACK && GRAPHCHK( GrHandle, Image ) ) return -1 ; if( GetRect == NULL ) @@ -220,7 +240,7 @@ static int GraphFilter_GetSoftImage( int GrHandle, BASEIMAGE *BaseImage, RECT *G if( NS_CreateARGB8ColorBaseImage( Width, Height, BaseImage ) < 0 ) return -1 ; - if( Image->Orig->FormatDesc.TextureFlag ) + if( GrHandle != DX_SCREEN_BACK && Image->Orig->FormatDesc.TextureFlag ) { HardDraw = Image->Hard.Draw ; for( i = 0 ; i < Image->Hard.DrawNum ; i ++, HardDraw ++ ) @@ -384,33 +404,44 @@ static int GraphFilter_SoftImageTerminate( GRAPHFILTER_INFO *Info ) if( Info->DestBaseImage.GraphData ) { - RECT Rect ; - - Rect.left = 0 ; - Rect.top = 0 ; - Rect.right = Info->DestWidth ; - Rect.bottom = Info->DestHeight ; - Graphics_Image_BltBmpOrBaseImageToGraph3( - &Rect, - Info->DestX, Info->DestY, - Info->DestGrHandle, - &Info->DestBaseImage, - NULL, - FALSE, - FALSE, - FALSE - ) ; -/* - if( Info->UseTempDestImage ) + if( Info->DestGrHandle == DX_SCREEN_BACK ) { - if( Info->TempDestImage.GraphData ) + int BlendMode, BlendParam ; + NS_GetDrawBlendMode( &BlendMode, &BlendParam ) ; + NS_SetDrawBlendMode( DX_BLENDMODE_SRCCOLOR, 255 ) ; + NS_DrawBaseImage( Info->DestX, Info->DestY, &Info->DestBaseImage ) ; + NS_SetDrawBlendMode( BlendMode, BlendParam ) ; + } + else + { + RECT Rect ; + + Rect.left = 0 ; + Rect.top = 0 ; + Rect.right = Info->DestWidth ; + Rect.bottom = Info->DestHeight ; + Graphics_Image_BltBmpOrBaseImageToGraph3( + &Rect, + Info->DestX, Info->DestY, + Info->DestGrHandle, + &Info->DestBaseImage, + NULL, + FALSE, + FALSE, + FALSE + ) ; + /* + if( Info->UseTempDestImage ) { - NS_BltBaseImage( 0, 0, Info->DestWidth, Info->DestHeight, 0, 0, &Info->TempDestImage, &Info->DestBaseImage ) ; + if( Info->TempDestImage.GraphData ) + { + NS_BltBaseImage( 0, 0, Info->DestWidth, Info->DestHeight, 0, 0, &Info->TempDestImage, &Info->DestBaseImage ) ; + } } - } - Graphics_Screen_UnlockDrawScreen() ; -*/ + Graphics_Screen_UnlockDrawScreen() ; + */ + } } if( Info->DestBaseImage.GraphData ) @@ -459,6 +490,11 @@ extern int GraphFilter_RectBltBase( { SrcImageWidth = SrcImage->WidthI ; SrcImageHeight = SrcImage->HeightI ; + +#ifndef DX_NON_MOVIE + if( SrcImage->Orig->MovieHandle != -1 ) + UpdateMovie( SrcImage->Orig->MovieHandle, FALSE ) ; +#endif } else if( !SHADOWMAPCHK( SrcGrHandle, SrcShadowMap ) ) @@ -471,6 +507,11 @@ extern int GraphFilter_RectBltBase( return -1 ; } + if( DestGrHandle == DX_SCREEN_BACK ) + { + NS_GetDrawScreenSize( &DestImageWidth, &DestImageHeight ) ; + } + else if( !GRAPHCHK( DestGrHandle, DestImage ) ) { DestImageWidth = DestImage->WidthI ; @@ -502,6 +543,11 @@ extern int GraphFilter_RectBltBase( if( FilterOrBlendType < 0 || FilterOrBlendType >= DX_GRAPH_BLEND_NUM ) return -1; + +#ifndef DX_NON_MOVIE + if( BlendImage->Orig->MovieHandle != -1 ) + UpdateMovie( BlendImage->Orig->MovieHandle, FALSE ) ; +#endif } else { @@ -622,6 +668,7 @@ extern int GraphFilter_RectBltBase( return 0 ; // 情報のセット + Info.BltBlendMode = SrcGrHandle == DestGrHandle ? DX_BLENDMODE_NOBLEND : GraphFilterSystemData.BltBlendMode ; Info.IsBlend = IsBlend ; Info.FilterOrBlendType = FilterOrBlendType ; Info.BlendGrHandle = BlendGrHandle ; @@ -758,6 +805,19 @@ extern int GraphFilter_RectBltBase( Param.GM_Reverse = va_arg( ParamList, int ) ; break ; + case DX_GRAPH_FILTER_PMA_REPLACEMENT: + IsPMA = 1 ; + case DX_GRAPH_FILTER_REPLACEMENT: + Param.TargetColor.r = ( BYTE )va_arg( ParamList, int ) ; + Param.TargetColor.g = ( BYTE )va_arg( ParamList, int ) ; + Param.TargetColor.b = ( BYTE )va_arg( ParamList, int ) ; + Param.TargetColor.a = ( BYTE )va_arg( ParamList, int ) ; + Param.NextColor.r = ( BYTE )va_arg( ParamList, int ) ; + Param.NextColor.g = ( BYTE )va_arg( ParamList, int ) ; + Param.NextColor.b = ( BYTE )va_arg( ParamList, int ) ; + Param.NextColor.a = ( BYTE )va_arg( ParamList, int ) ; + break ; + case DX_GRAPH_FILTER_PREMUL_ALPHA : break ; @@ -812,7 +872,8 @@ extern int GraphFilter_RectBltBase( DestImage = NULL ; DestShadowMap = NULL ; - if( GRAPHCHK( UseDestGrHandle, DestImage ) && + if( UseDestGrHandle != DX_SCREEN_BACK && + GRAPHCHK( UseDestGrHandle, DestImage ) && SHADOWMAPCHK( UseDestGrHandle, DestShadowMap ) ) break ; @@ -919,6 +980,11 @@ extern int GraphFilter_RectBltBase( FilterResult = GraphFilter_GradientMap( &Info, Param.GM_MapGrHandle, Param.GM_Reverse, IsPMA ) ; break ; + case DX_GRAPH_FILTER_PMA_REPLACEMENT: + case DX_GRAPH_FILTER_REPLACEMENT : + FilterResult = GraphFilter_Replacement( &Info, Param.TargetColor, Param.NextColor, IsPMA ) ; + break ; + case DX_GRAPH_FILTER_PREMUL_ALPHA : FilterResult = GraphFilter_PremulAlpha( &Info ) ; break ; @@ -3474,6 +3540,115 @@ extern int GraphFilter_GradientMap( GRAPHFILTER_INFO *Info, int MapGrHandle, int return 0 ; } +extern int GraphFilter_Replacement( GRAPHFILTER_INFO *Info, COLOR_U8 TargetColor, COLOR_U8 NextColor, int IsPMA ) +{ + // シェーダーが使えるかどうかで処理を分岐 + if( GSYS.HardInfo.UseShader == TRUE ) + { + GraphFilter_Replacement_PF( Info, TargetColor, NextColor, IsPMA ) ; + } + else + { + // シェーダーが使えない場合 + + BYTE *Src ; + BYTE *Dest ; + DWORD i ; + DWORD Width ; + DWORD Height ; + DWORD SrcAddPitch ; + DWORD DestAddPitch ; + + if( GraphFilter_SoftImageSetup( Info ) < 0 ) + return -1 ; + + Src = ( BYTE * )Info->SrcBaseImage.GraphData ; + Dest = ( BYTE * )Info->DestBaseImage.GraphData ; + + Width = ( DWORD )( Info->SrcX2 - Info->SrcX1 ) ; + Height = ( DWORD )( Info->SrcY2 - Info->SrcY1 ) ; + + SrcAddPitch = Info->SrcBaseImage.Pitch - Width * 4 ; + DestAddPitch = Info->DestBaseImage.Pitch - Width * 4 ; + + if( IsPMA ) + { + NextColor.r = BASEIM.RgbToPmaTable[ NextColor.r ][ NextColor.a ] ; + NextColor.g = BASEIM.RgbToPmaTable[ NextColor.g ][ NextColor.a ] ; + NextColor.b = BASEIM.RgbToPmaTable[ NextColor.b ][ NextColor.a ] ; + + do + { + i = Width ; + do + { + if( BASEIM.PmaToRgbTable[ Src[ 0 ] ][ Src[ 3 ] ] == TargetColor.b && + BASEIM.PmaToRgbTable[ Src[ 1 ] ][ Src[ 3 ] ] == TargetColor.g && + BASEIM.PmaToRgbTable[ Src[ 2 ] ][ Src[ 3 ] ] == TargetColor.r && + Src[ 3 ] == TargetColor.a ) + { + Dest[ 0 ] = NextColor.b ; + Dest[ 1 ] = NextColor.g ; + Dest[ 2 ] = NextColor.r ; + Dest[ 3 ] = NextColor.a ; + } + else + { + Dest[ 0 ] = Src[ 0 ] ; + Dest[ 1 ] = Src[ 1 ] ; + Dest[ 2 ] = Src[ 2 ] ; + Dest[ 3 ] = Src[ 3 ] ; + } + + Src += 4 ; + Dest += 4 ; + }while( -- i ) ; + + Src += SrcAddPitch ; + Dest += DestAddPitch ; + }while( -- Height ) ; + } + else + { + do + { + i = Width ; + do + { + if( Src[ 0 ] == TargetColor.b && + Src[ 1 ] == TargetColor.g && + Src[ 2 ] == TargetColor.r && + Src[ 3 ] == TargetColor.a ) + { + Dest[ 0 ] = NextColor.b ; + Dest[ 1 ] = NextColor.g ; + Dest[ 2 ] = NextColor.r ; + Dest[ 3 ] = NextColor.a ; + } + else + { + Dest[ 0 ] = Src[ 0 ] ; + Dest[ 1 ] = Src[ 1 ] ; + Dest[ 2 ] = Src[ 2 ] ; + Dest[ 3 ] = Src[ 3 ] ; + } + + Src += 4 ; + Dest += 4 ; + }while( -- i ) ; + + Src += SrcAddPitch ; + Dest += DestAddPitch ; + }while( -- Height ) ; + } + + GraphFilter_SoftImageTerminate( Info ) ; + } + + // 終了 + return 0 ; +} + extern int GraphFilter_PremulAlpha( GRAPHFILTER_INFO *Info ) { // シェーダーが使えるかどうかで処理を分岐 diff --git a/DxGraphicsFilter.h b/DxGraphicsFilter.h index 2e3eba5..9aa2c1c 100644 --- a/DxGraphicsFilter.h +++ b/DxGraphicsFilter.h @@ -2,7 +2,7 @@ // // DXライブラリ GraphFilter系プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -32,6 +32,7 @@ namespace DxLib // フィルター情報構造体 struct GRAPHFILTER_INFO { + int BltBlendMode ; int IsBlend ; int FilterOrBlendType ; int SrcGrHandle ; @@ -96,6 +97,8 @@ struct GRAPHFILTER_PARAM int UVGrHandle ; int DestSizeX ; int DestSizeY ; + COLOR_U8 TargetColor ; + COLOR_U8 NextColor ; int RGBA_R ; int RGBA_G ; @@ -118,6 +121,7 @@ struct GRAPHFILTER_SHADER_HANDLE float PrevGamma ; // 前回のガンマフィルタの際のガンマ値 int TwoColorPS[ 2 ] ; // 2値化フィルター[ 0:通常用 1:乗算済みアルファ用 ] int GradientMapPS[ 2 ][ 2 ] ; // グラデーションマップフィルター[ 0:通常用 1:乗算済みアルファ用 ] + int ReplacementPS[ 2 ] ; // 色の置換[ 0:通常用 1:乗算済みアルファ用 ] int PreMulAlphaPS ; // 通常画像から乗算済みアルファ画像を作成する為のフィルター int InterpAlphaPS ; // 乗算済みアルファ画像から通常画像を作成する為のフィルター int YUVtoRGBPS[ 4 ] ; // YUVカラーをRGBカラーに変換するフィルター @@ -131,9 +135,16 @@ struct GRAPHFILTER_SHADER_HANDLE int RgbaMixS[ 4 ][ 4 ][ 4 ][ 4 ][ 2 ] ; // RGBAMixブレンドの S だけの組み合わせ256個[ R ][ G ][ B ][ A ][ 0:通常用 1:乗算済みアルファ用 ] } ; +// フィルター処理のシステムデータ +struct GRAPHFILTER_SYSTEM_DATA +{ + int BltBlendMode ; // 転送先とのブレンドモード +} ; + // 内部大域変数宣言 -------------------------------------------------------------- extern GRAPHFILTER_SHADER_HANDLE GraphFilterShaderHandle ; +extern GRAPHFILTER_SYSTEM_DATA GraphFilterSystemData ; // 関数プロトタイプ宣言----------------------------------------------------------- @@ -150,6 +161,7 @@ extern int GraphFilter_Invert( GRAPHFILTER_INFO *Info, int IsPMA ) ; extern int GraphFilter_Level( GRAPHFILTER_INFO *Info, float Min, float Max, float Gamma, float AfterMin, float AfterMax, int IsPMA ) ; extern int GraphFilter_TwoColor( GRAPHFILTER_INFO *Info, float Threshold, COLOR_F *LowColor, COLOR_F *HighColor, int IsPMA ) ; extern int GraphFilter_GradientMap( GRAPHFILTER_INFO *Info, int MapGrHandle, int Reverse, int IsPMA ) ; +extern int GraphFilter_Replacement( GRAPHFILTER_INFO *Info, COLOR_U8 TargetColor, COLOR_U8 NextColor, int IsPMA ) ; extern int GraphFilter_PremulAlpha( GRAPHFILTER_INFO *Info ) ; extern int GraphFilter_InterpAlpha( GRAPHFILTER_INFO *Info ) ; extern int GraphFilter_YUVtoRGB( GRAPHFILTER_INFO *Info, int UVGrHandle ) ; @@ -178,6 +190,7 @@ extern int GraphFilter_Invert_PF( GRAPHFILTER_INFO *Info, int IsPMA ) ; extern int GraphFilter_Level_PF( GRAPHFILTER_INFO *Info, float Min, float Max, float Gamma, float AfterMin, float AfterMax, int IsPMA ) ; extern int GraphFilter_TwoColor_PF( GRAPHFILTER_INFO *Info, float Threshold, COLOR_F *LowColor, COLOR_F *HighColor, int IsPMA ) ; extern int GraphFilter_GradientMap_PF( GRAPHFILTER_INFO *Info, int MapGrHandle, int Reverse, int IsPMA ) ; +extern int GraphFilter_Replacement_PF( GRAPHFILTER_INFO *Info, COLOR_U8 TargetColor, COLOR_U8 NextColor, int IsPMA ) ; extern int GraphFilter_PremulAlpha_PF( GRAPHFILTER_INFO *Info ) ; extern int GraphFilter_InterpAlpha_PF( GRAPHFILTER_INFO *Info ) ; extern int GraphFilter_YUVtoRGB_PF( GRAPHFILTER_INFO *Info, int UVGrHandle ) ; diff --git a/DxHandle.cpp b/DxHandle.cpp index b318877..c47eb73 100644 --- a/DxHandle.cpp +++ b/DxHandle.cpp @@ -2,7 +2,7 @@ // // DXライブラリ ハンドル管理プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxHandle.h b/DxHandle.h index 90b5de9..a279d21 100644 --- a/DxHandle.h +++ b/DxHandle.h @@ -2,7 +2,7 @@ // // DXライブラリ ハンドル管理プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -23,12 +23,12 @@ namespace DxLib // マクロ定義 -------------------------------------------------------------------- // ハンドルの内訳 -#define DX_HANDLEINDEX_MASK (0x0000ffff) // ハンドル配列インデックスマスク -#define DX_HANDLEINDEX_MAX (65536) // ハンドル配列インデックスの最大数 +#define DX_HANDLEINDEX_MASK (0x0003ffff) // ハンドル配列インデックスマスク +#define DX_HANDLEINDEX_MAX (0x40000) // ハンドル配列インデックスの最大数 -#define DX_HANDLECHECK_MASK (0x03ff0000) // ハンドルの正当性チェック用マスク -#define DX_HANDLECHECK_ADDRESS (16) // ハンドルの正当性チェック用マスクの開始アドレス -#define DX_HANDLECHECK_MAX (1024) // ハンドルの正当性チェック値の最大数 +#define DX_HANDLECHECK_MASK (0x03fc0000) // ハンドルの正当性チェック用マスク +#define DX_HANDLECHECK_ADDRESS (18) // ハンドルの正当性チェック用マスクの開始アドレス +#define DX_HANDLECHECK_MAX (256) // ハンドルの正当性チェック値の最大数 #define DX_HANDLETYPE_MASK (0x7c000000) // ハンドルタイプマスク #define DX_HANDLETYPE_ADDRESS (26) // ハンドルタイプマスクの開始アドレス diff --git a/DxHeap.cpp b/DxHeap.cpp index fe3234f..e98b1ad 100644 --- a/DxHeap.cpp +++ b/DxHeap.cpp @@ -2,7 +2,7 @@ // // DXライブラリ ヒープ関連プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxHeap.h b/DxHeap.h index 502b868..665422b 100644 --- a/DxHeap.h +++ b/DxHeap.h @@ -2,7 +2,7 @@ // // DXライブラリ ヒープ関係プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxInput.cpp b/DxInput.cpp index 48d70ca..f0d3adc 100644 --- a/DxInput.cpp +++ b/DxInput.cpp @@ -2,7 +2,7 @@ // // DXライブラリ DirectInput制御プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxInput.h b/DxInput.h index 60f8453..20f742c 100644 --- a/DxInput.h +++ b/DxInput.h @@ -2,7 +2,7 @@ // // DXライブラリ 入力情報プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxInputString.cpp b/DxInputString.cpp index 30d5cc0..efe8121 100644 --- a/DxInputString.cpp +++ b/DxInputString.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 文字列入力プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxInputString.h b/DxInputString.h index a7d9a57..eadc8c9 100644 --- a/DxInputString.h +++ b/DxInputString.h @@ -2,7 +2,7 @@ // // DXライブラリ 文字列入力プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxLib.h b/DxLib.h index 98b6c5b..9761673 100644 --- a/DxLib.h +++ b/DxLib.h @@ -2,7 +2,7 @@ // // DXライブラリ ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -12,9 +12,9 @@ #include "DxCompileConfig.h" // DXライブラリのバージョン -#define DXLIB_VERSION 0x321f -#define DXLIB_VERSION_STR_T _T( "3.21f" ) -#define DXLIB_VERSION_STR_W L"3.21f" +#define DXLIB_VERSION 0x322a +#define DXLIB_VERSION_STR_T _T( "3.22a" ) +#define DXLIB_VERSION_STR_W L"3.22a" // 設定 ----------------------------------------------------------------------- @@ -43,13 +43,10 @@ #define DX_DEFINE_START -#define MAX_IMAGE_NUM (32768) // 同時に持てるグラフィックハンドルの最大数( ハンドルエラーチェックのマスクに使用しているので 65536 以下の 2 のべき乗にして下さい ) -#define MAX_2DSURFACE_NUM (32768) // 2Dサーフェスデータの最大数( ハンドルエラーチェックのマスクに使用しているので 65536 以下の 2 のべき乗にして下さい ) -#define MAX_3DSURFACE_NUM (65536) // 3Dサーフェスデータの最大数( ハンドルエラーチェックのマスクに使用しているので 65536 以下の 2 のべき乗にして下さい ) +#define MAX_IMAGE_NUM (0x40000) // 同時に持てるグラフィックハンドルの最大数( ハンドルエラーチェックのマスクに使用しているので 0x40000 以下の 2 のべき乗にして下さい ) #define MAX_IMAGE_DIVNUM (64) // 画像分割の最大数 -#define MAX_SURFACE_NUM (65536) // サーフェスデータの最大数 #define MAX_SHADOWMAP_NUM (8192) // シャドウマップデータの最大数 -#define MAX_SOFTIMAGE_NUM (8192) // 同時に持てるソフトイメージハンドルの最大数( ハンドルエラーチェックのマスクに使用しているので 65536 以下の 2 のべき乗にして下さい ) +#define MAX_SOFTIMAGE_NUM (8192) // 同時に持てるソフトイメージハンドルの最大数( ハンドルエラーチェックのマスクに使用しているので 0x40000 以下の 2 のべき乗にして下さい ) #define MAX_SOUND_NUM (32768) // 同時に持てるサウンドハンドルの最大数 #define MAX_SOFTSOUND_NUM (8192) // 同時に持てるソフトウエアサウンドハンドルの最大数 @@ -246,22 +243,24 @@ #define DX_GRAPH_FILTER_LEVEL (7) // レベル補正フィルタ #define DX_GRAPH_FILTER_TWO_COLOR (8) // 2階調化フィルタ #define DX_GRAPH_FILTER_GRADIENT_MAP (9) // グラデーションマップフィルタ -#define DX_GRAPH_FILTER_PREMUL_ALPHA (10) // 通常のアルファチャンネル付き画像を乗算済みアルファ画像に変換するフィルタ -#define DX_GRAPH_FILTER_INTERP_ALPHA (11) // 乗算済みα画像を通常のアルファチャンネル付き画像に変換するフィルタ -#define DX_GRAPH_FILTER_YUV_TO_RGB (12) // YUVカラーをRGBカラーに変換するフィルタ -#define DX_GRAPH_FILTER_Y2UV1_TO_RGB (13) // YUVカラーをRGBカラーに変換するフィルタ( UV成分が Y成分の半分・又は4分の1( 横・縦片方若しくは両方 )の解像度しかない場合用 ) -#define DX_GRAPH_FILTER_YUV_TO_RGB_RRA (14) // YUVカラーをRGBカラーに変換するフィルタ( 且つ右側半分のRの値をアルファ値として扱う ) -#define DX_GRAPH_FILTER_Y2UV1_TO_RGB_RRA (15) // YUVカラーをRGBカラーに変換するフィルタ( UV成分が Y成分の半分・又は4分の1( 横・縦片方若しくは両方 )の解像度しかない場合用 )( 且つ右側半分のRの値をアルファ値として扱う ) -#define DX_GRAPH_FILTER_BICUBIC_SCALE (16) // バイキュービックを使用した拡大・縮小フィルタ -#define DX_GRAPH_FILTER_LANCZOS3_SCALE (17) // Lanczos-3を使用した拡大・縮小フィルタ -#define DX_GRAPH_FILTER_PMA_BRIGHT_CLIP (18) // 明るさクリップフィルタ(乗算済みアルファ画像用) -#define DX_GRAPH_FILTER_PMA_BRIGHT_SCALE (19) // 指定の明るさ領域を拡大するフィルタ(乗算済みアルファ画像用) -#define DX_GRAPH_FILTER_PMA_HSB (20) // 色相・彩度・明度フィルタ(乗算済みアルファ画像用) -#define DX_GRAPH_FILTER_PMA_INVERT (21) // 階調の反転フィルタ(乗算済みアルファ画像用) -#define DX_GRAPH_FILTER_PMA_LEVEL (22) // レベル補正フィルタ(乗算済みアルファ画像用) -#define DX_GRAPH_FILTER_PMA_TWO_COLOR (23) // 2階調化フィルタ(乗算済みアルファ画像用) -#define DX_GRAPH_FILTER_PMA_GRADIENT_MAP (24) // グラデーションマップフィルタ(乗算済みアルファ画像用) -#define DX_GRAPH_FILTER_NUM (25) +#define DX_GRAPH_FILTER_REPLACEMENT (10) // 色の置換 +#define DX_GRAPH_FILTER_PREMUL_ALPHA (11) // 通常のアルファチャンネル付き画像を乗算済みアルファ画像に変換するフィルタ +#define DX_GRAPH_FILTER_INTERP_ALPHA (12) // 乗算済みα画像を通常のアルファチャンネル付き画像に変換するフィルタ +#define DX_GRAPH_FILTER_YUV_TO_RGB (13) // YUVカラーをRGBカラーに変換するフィルタ +#define DX_GRAPH_FILTER_Y2UV1_TO_RGB (14) // YUVカラーをRGBカラーに変換するフィルタ( UV成分が Y成分の半分・又は4分の1( 横・縦片方若しくは両方 )の解像度しかない場合用 ) +#define DX_GRAPH_FILTER_YUV_TO_RGB_RRA (15) // YUVカラーをRGBカラーに変換するフィルタ( 且つ右側半分のRの値をアルファ値として扱う ) +#define DX_GRAPH_FILTER_Y2UV1_TO_RGB_RRA (16) // YUVカラーをRGBカラーに変換するフィルタ( UV成分が Y成分の半分・又は4分の1( 横・縦片方若しくは両方 )の解像度しかない場合用 )( 且つ右側半分のRの値をアルファ値として扱う ) +#define DX_GRAPH_FILTER_BICUBIC_SCALE (17) // バイキュービックを使用した拡大・縮小フィルタ +#define DX_GRAPH_FILTER_LANCZOS3_SCALE (18) // Lanczos-3を使用した拡大・縮小フィルタ +#define DX_GRAPH_FILTER_PMA_BRIGHT_CLIP (19) // 明るさクリップフィルタ(乗算済みアルファ画像用) +#define DX_GRAPH_FILTER_PMA_BRIGHT_SCALE (20) // 指定の明るさ領域を拡大するフィルタ(乗算済みアルファ画像用) +#define DX_GRAPH_FILTER_PMA_HSB (21) // 色相・彩度・明度フィルタ(乗算済みアルファ画像用) +#define DX_GRAPH_FILTER_PMA_INVERT (22) // 階調の反転フィルタ(乗算済みアルファ画像用) +#define DX_GRAPH_FILTER_PMA_LEVEL (23) // レベル補正フィルタ(乗算済みアルファ画像用) +#define DX_GRAPH_FILTER_PMA_TWO_COLOR (24) // 2階調化フィルタ(乗算済みアルファ画像用) +#define DX_GRAPH_FILTER_PMA_GRADIENT_MAP (25) // グラデーションマップフィルタ(乗算済みアルファ画像用) +#define DX_GRAPH_FILTER_PMA_REPLACEMENT (26) // 色の置換(乗算済みアルファ画像用) +#define DX_GRAPH_FILTER_NUM (27) // グラフィックブレンドタイプ #define DX_GRAPH_BLEND_NORMAL (0) // 通常 @@ -309,6 +308,14 @@ #define DX_RGBA_SELECT_BLEND_G (5) // ブレンド画像の緑成分 #define DX_RGBA_SELECT_BLEND_B (6) // ブレンド画像の青成分 #define DX_RGBA_SELECT_BLEND_A (7) // ブレンド画像のα成分 +#define DX_RGBA_SELECT_SRC_INV_R (8) // 元画像の赤成分を反転したもの +#define DX_RGBA_SELECT_SRC_INV_G (9) // 元画像の緑成分を反転したもの +#define DX_RGBA_SELECT_SRC_INV_B (10) // 元画像の青成分を反転したもの +#define DX_RGBA_SELECT_SRC_INV_A (11) // 元画像のα成分を反転したもの +#define DX_RGBA_SELECT_BLEND_INV_R (12) // ブレンド画像の赤成分を反転したもの +#define DX_RGBA_SELECT_BLEND_INV_G (13) // ブレンド画像の緑成分を反転したもの +#define DX_RGBA_SELECT_BLEND_INV_B (14) // ブレンド画像の青成分を反転したもの +#define DX_RGBA_SELECT_BLEND_INV_A (15) // ブレンド画像のα成分を反転したもの // フィルモード #define DX_FILL_WIREFRAME (2) // ワイヤーフレーム @@ -1840,6 +1847,7 @@ typedef struct tagIPDATA_IPv6 + #ifndef DX_NON_NAMESPACE namespace DxLib @@ -3159,6 +3167,8 @@ extern DXLIBAPI int MailApp_SendWithStrLen( const TCHAR *MailAddr = NULL , siz // フィルター関係関数 #ifndef DX_NON_FILTER +extern DXLIBAPI int SetGraphFilterBltBlendMode( int BlendMode /* DX_BLENDMODE_ALPHA など */ ) ; // GraphFilterBlt や GraphBlendBlt の結果を転送先に転送する際のブレンドモードを設定する( 現状で対応しているのは DX_BLENDMODE_NOBLEND と DX_BLENDMODE_ALPHA のみ ) + extern DXLIBAPI int GraphFilter( int GrHandle, int FilterType /* DX_GRAPH_FILTER_GAUSS 等 */ , ... ) ; // 画像にフィルター処理を行う extern DXLIBAPI int GraphFilterBlt( int SrcGrHandle, int DestGrHandle, int FilterType /* DX_GRAPH_FILTER_GAUSS 等 */ , ... ) ; // 画像のフィルター付き転送を行う extern DXLIBAPI int GraphFilterRectBlt( int SrcGrHandle, int DestGrHandle, int SrcX1, int SrcY1, int SrcX2, int SrcY2, int DestX, int DestY, int FilterType /* DX_GRAPH_FILTER_GAUSS 等 */ , ... ) ; // 画像のフィルター付き転送を行う( 矩形指定 ) @@ -3172,6 +3182,7 @@ extern DXLIBAPI int MailApp_SendWithStrLen( const TCHAR *MailAddr = NULL , siz // int GraphFilter( int GrHandle, int FilterType = DX_GRAPH_FILTER_LEVEL, int Min = 変換元の下限値( 0 〜 255 ), int Max = 変換元の上限値( 0 〜 255 ), int Gamma = ガンマ値( 100 でガンマ補正無し、0 とそれ以下の値は不可 ), int AfterMin = 変換後の最低値( 0 〜 255 ), int AfterMax = 変換後の最大値( 0 〜 255 ) ) ; // int GraphFilter( int GrHandle, int FilterType = DX_GRAPH_FILTER_TWO_COLOR, int Threshold = 閾値( 0 〜 255 ), unsigned int LowColor = 閾値より値が低かったピクセルの変換後の色値( GetColor で取得する ), int LowAlpha = 閾値より値が低かったピクセルの変換後のα値( 0 〜 255 ), unsigned int HighColor = 閾値より値が高かったピクセルの変換後の色値( GetColor で取得する ), int HighAlpha = 閾値より値が高かったピクセルの変換後のα値( 0 〜 255 ) ) ; // int GraphFilter( int GrHandle, int FilterType = DX_GRAPH_FILTER_GRADIENT_MAP, int MapGrHandle = グラデーションマップのグラフィックハンドル( 元画像の輝度からグラデーションマップ画像の x 座標を算出しますので縦幅は1dotでもOK ), int Reverse = グラデーションマップ左右反転フラグ( TRUE : グラデーションマップを左右反転して使う FALSE : 左右反転しない ) ) ; +// int GraphFilter( int GrHandle, int FilterType = DX_GRAPH_FILTER_REPLACEMENT, int TargetR, int TargetG, int TargetB, int TargetA = 置換対象の色( 0〜255 ), int R, int G, int B, int A = 置換後の色( 0〜255 ) ) ; // int GraphFilter( int GrHandle, int FilterType = DX_GRAPH_FILTER_PREMUL_ALPHA ) ; // 通常のアルファチャンネル付き画像を乗算済みアルファ画像に変換するフィルタ // int GraphFilter( int GrHandle, int FilterType = DX_GRAPH_FILTER_INTERP_ALPHA ) ; // 乗算済みα画像を通常のアルファチャンネル付き画像に変換するフィルタ // int GraphFilter( int GrHandle, int FilterType = DX_GRAPH_FILTER_YUV_TO_RGB ) ; // YUVカラーをRGBカラーに変換するフィルタ @@ -4671,6 +4682,12 @@ extern DXLIBAPI int CreateColorData( COLORDATA *ColorDataBuf, int Col // 特殊関数 extern DXLIBAPI int GetMP3TagInfo( const TCHAR *FileName, TCHAR *TitleBuffer, size_t TitleBufferBytes, TCHAR *ArtistBuffer, size_t ArtistBufferBytes, TCHAR *AlbumBuffer, size_t AlbumBufferBytes, TCHAR *YearBuffer, size_t YearBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes, TCHAR *TrackBuffer, size_t TrackBufferBytes, TCHAR *GenreBuffer, size_t GenreBufferBytes, int *PictureGrHandle ) ; // MP3ファイルのタグ情報を取得する extern DXLIBAPI int GetMP3TagInfoWithStrLen( const TCHAR *FileName, size_t FileNameLength, TCHAR *TitleBuffer, size_t TitleBufferBytes, TCHAR *ArtistBuffer, size_t ArtistBufferBytes, TCHAR *AlbumBuffer, size_t AlbumBufferBytes, TCHAR *YearBuffer, size_t YearBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes, TCHAR *TrackBuffer, size_t TrackBufferBytes, TCHAR *GenreBuffer, size_t GenreBufferBytes, int *PictureGrHandle ) ; // MP3ファイルのタグ情報を取得する +#ifndef DX_NON_OGGVORBIS +extern DXLIBAPI int GetOggCommentNum( const TCHAR *FileName ) ; // Oggファイルのコメント情報の数を取得する +extern DXLIBAPI int GetOggCommentNumWithStrLen( const TCHAR *FileName, size_t FileNameLength ) ; // Oggファイルのコメント情報の数を取得する +extern DXLIBAPI int GetOggComment( const TCHAR *FileName, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) ; // Oggファイルのコメント情報を取得する +extern DXLIBAPI int GetOggCommentWithStrLen( const TCHAR *FileName, size_t FileNameLength, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) ; // Oggファイルのコメント情報を取得する +#endif // DX_NON_OGGVORBIS // 設定関係関数 @@ -5033,6 +5050,8 @@ extern DXLIBAPI int CreateColorData( COLORDATA *ColorDataBuf, int Col extern DXLIBAPI float MV1GetMaterialSpcPower( int MHandle, int MaterialIndex ) ; // 指定のマテリアルのスペキュラの強さを取得する extern DXLIBAPI int MV1SetMaterialDifMapTexture( int MHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでディフューズマップとして使用するテクスチャを指定する extern DXLIBAPI int MV1GetMaterialDifMapTexture( int MHandle, int MaterialIndex ) ; // 指定のマテリアルでディフューズマップとして使用されているテクスチャのインデックスを取得する +extern DXLIBAPI int MV1SetMaterialSubDifMapTexture( int MHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでサブディフューズマップとして使用するテクスチャを指定する +extern DXLIBAPI int MV1GetMaterialSubDifMapTexture( int MHandle, int MaterialIndex ) ; // 指定のマテリアルでサブディフューズマップとして使用されているテクスチャのインデックスを取得する extern DXLIBAPI int MV1SetMaterialSpcMapTexture( int MHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでスペキュラマップとして使用するテクスチャを指定する extern DXLIBAPI int MV1GetMaterialSpcMapTexture( int MHandle, int MaterialIndex ) ; // 指定のマテリアルでスペキュラマップとして使用されているテクスチャのインデックスを取得する extern DXLIBAPI int MV1GetMaterialNormalMapTexture( int MHandle, int MaterialIndex ) ; // 指定のマテリアルで法線マップとして使用されているテクスチャのインデックスを取得する diff --git a/DxLib.txt b/DxLib.txt index 68f7f6a..57b26e7 100644 --- a/DxLib.txt +++ b/DxLib.txt @@ -2,7 +2,7 @@ // // DXライブラリ さわり // -// Ver 3.21f By 山田 巧 +// Ver 3.22a By 山田 巧 // //=============================================================================================== diff --git a/DxLive2DCubism4.cpp b/DxLive2DCubism4.cpp index 5d49243..0e38bb6 100644 --- a/DxLive2DCubism4.cpp +++ b/DxLive2DCubism4.cpp @@ -2,7 +2,7 @@ // // DXライブラリ Live2D Cubism4 関係プログラム // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- @@ -350,6 +350,9 @@ extern int NS_Live2D_RenderBegin( void ) return -1 ; } + // 各種描画設定情報を取得 + Graphics_DrawSetting_GetScreenDrawSettingInfo( &LIVE2DSYS.ScreenDrawSettingInfo ) ; + // D3D11 フレーム先頭処理 // 各フレームでの、Cubismの処理前にコール NS_GetGraphSize( NS_GetDrawScreen(), &windowWidth, &windowHeight ) ; @@ -369,9 +372,13 @@ extern int NS_Live2D_RenderEnd( void ) } // D3D11 フレーム終了処理 - // 各フレームでの、Cubismの処理後にコール + // 各フレームでの、Cubismの処理後にコール D_CubismRenderer_DxLib::EndFrame() ; + // DXライブラリ用の設定に戻す + Graphics_Hardware_RefreshSetting_PF() ; + Graphics_DrawSetting_SetScreenDrawSettingInfo( &LIVE2DSYS.ScreenDrawSettingInfo ) ; + // 正常終了 return 0 ; } diff --git a/DxLive2DCubism4.h b/DxLive2DCubism4.h index b0ad904..1c98e1a 100644 --- a/DxLive2DCubism4.h +++ b/DxLive2DCubism4.h @@ -1,15 +1,15 @@ // ------------------------------------------------------------------------------- // -// ソスcソスwソスソスソスCソスuソスソスソスソス Live2D Cubism4 ソスヨ係ソスvソスソスソスOソスソスソスソスソスwソスbソス_ソスtソス@ソスCソスソス +// DXライブラリ Live2D Cubism4 関係プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- #ifndef DXLIVE2D_CUBISM4_H #define DXLIVE2D_CUBISM4_H -// ソスCソスソスソスNソスソスソス[ソスh ------------------------------------------------------------------ +// インクルード ------------------------------------------------------------------ #include "DxCompileConfig.h" #ifndef DX_NON_LIVE2D_CUBISM4 @@ -51,7 +51,7 @@ namespace DxLib #endif// DX_NON_NAMESPACE -// ソス}ソスNソスソスソスソス` -------------------------------------------------------------------- +// マクロ定義 -------------------------------------------------------------------- #define LIVE2DSYS Live2DCubism4SysData #define LIVE2DDLL Live2DCubism4DLLData @@ -132,18 +132,18 @@ namespace DxLib #define CALL_csmResetDrawableDynamicFlags( x ) ( Live2DCubism4DLLData.csmResetDrawableDynamicFlags x ) #endif // WINDOWS_DESKTOP_OS -// ソス\ソスソスソスフ抵ソス` -------------------------------------------------------------------- +// 構造体定義 -------------------------------------------------------------------- -// ソスtソス@ソスCソスソスソスソスソスソスLive2Dソスソスソスfソスソスソスnソスソスソスhソスソスソスソスソス成ソスソスソス髀茨ソスソスソスノ必ソスvソスネグソスソスソス[ソスoソスソスソスfソス[ソス^ソスソスZソス゚ゑソスソスソスソスソス +// ファイルからLive2Dモデルハンドルを作成する処理に必要なグローバルデータを纏めたもの struct LIVE2DCUBISM4_LOADMODEL_GPARAM { int Dummy ; } ; -// Live2D Cubism4 ソスソスソスfソスソスソスソスソス +// Live2D Cubism4 モデル情報 struct LIVE2DCUBISM4MODEL { - HANDLEINFO HandleInfo ; // ソスnソスソスソスhソスソスソスソスソスハデソス[ソス^ + HANDLEINFO HandleInfo ; // ハンドル共通データ float PosX ; float PosY ; @@ -154,10 +154,10 @@ struct LIVE2DCUBISM4MODEL D_LAppModel * AppModel ; } ; -// Live2D Cubism4 DLL ソスフ関撰ソスソス|ソスCソスソスソス^ソス\ソスソスソスソス +// Live2D Cubism4 DLL の関数ポインタ構造体 struct LIVE2DCUBISM4DLL { - wchar_t Live2DCubismCoreDLLPath[ 1024 ] ; // Live2D Cubism Core DLL ソスフフソス@ソスCソスソスソスpソスX + wchar_t Live2DCubismCoreDLLPath[ 1024 ] ; // Live2D Cubism Core DLL のファイルパス DWORD ( *csmGetVersion )( void ) ; DWORD ( *csmGetLatestMocVersion )( void ) ; @@ -236,49 +236,51 @@ struct LIVE2DCUBISM4DLL #endif // WINDOWS_DESKTOP_OS } ; -// Live2D Cubism4 ソスVソスXソスeソスソスソスpソスfソス[ソス^ソス\ソスソスソスソス +// Live2D Cubism4 システム用データ構造体 struct LIVE2DCUBISM4SYSTEMDATA { - int InitializeFlag ; // ソスソスソスソスソスソスソスtソスソスソスO + int InitializeFlag ; // 初期化フラグ - int EnableConstantBuffer ; // ソスRソスソスソスXソス^ソスソスソスgソスoソスbソスtソス@ソスソスソスgソスpソスナゑソスソス驍ゥソスヌゑソスソスソス + int EnableConstantBuffer ; // コンスタントバッファが使用できるかどうか + + SCREENDRAWSETTINGINFO ScreenDrawSettingInfo ; // Live2D描画開始前の描画設定 D_CubismIdManager * s_cubismIdManager ; - DXARC ShaderBinDxa ; // ソスVソスFソス[ソス_ソス[ソスIソスuソスWソスFソスNソスgソスtソス@ソスCソスソスソスcソスwソス`ソス\ソスソスソスソス - void *ShaderBinDxaImage ; // ソスVソスFソス[ソス_ソス[ソスIソスuソスWソスFソスNソスgソスtソス@ソスCソスソスソスcソスwソス`ソスフバソスCソスiソスソスソスCソスソスソス[ソスW + DXARC ShaderBinDxa ; // シェーダーオブジェクトファイルDXA構造体 + void *ShaderBinDxaImage ; // シェーダーオブジェクトファイルDXAのバイナリイメージ - LIVE2DCUBISM4SYSTEMDATA_PF PF ; // ソスツ具ソスソスヒ托ソスソスfソス[ソス^ + LIVE2DCUBISM4SYSTEMDATA_PF PF ; // 環境依存データ } ; -// ソスeソス[ソスuソスソス----------------------------------------------------------------------- +// テーブル----------------------------------------------------------------------- -// ソスソスソスソスソスソスソスマ撰ソスソス骭セ -------------------------------------------------------------- +// 内部大域変数宣言 -------------------------------------------------------------- -// Live2D Cubism4 ソスVソスXソスeソスソスソスfソス[ソス^ +// Live2D Cubism4 システムデータ extern LIVE2DCUBISM4SYSTEMDATA Live2DCubism4SysData ; // Live2D Cubism 4 DLL extern LIVE2DCUBISM4DLL Live2DCubism4DLLData ; -// ソスヨ撰ソスソスvソスソスソスgソス^ソスCソスvソス骭セ----------------------------------------------------------- +// 関数プロトタイプ宣言----------------------------------------------------------- -// Live2D Cubism4 ソスヨ連ソスフ擾ソスソスソスソスソスソスニ鯉ソスnソスソス -extern int Live2DCubism4_Initialize( void ) ; // Live2D Cubism4 ソスフ擾ソスソスソスソスソス -extern int Live2DCubism4_Terminate( void ) ; // Live2D Cubism4 ソスフ鯉ソスnソスソス +// Live2D Cubism4 関連の初期化と後始末 +extern int Live2DCubism4_Initialize( void ) ; // Live2D Cubism4 の初期化 +extern int Live2DCubism4_Terminate( void ) ; // Live2D Cubism4 の後始末 -extern int Live2DCubism4_SetupShaderCode( int *ShaderCodeBinConvert, BYTE *ShaderCodeBin ) ; // ソスVソスFソス[ソス_ソス[DXAソスtソス@ソスCソスソスソスフセソスbソスgソスAソスbソスv -extern int Live2DCubism4_LoadShaderCode( const char *ShaderName, int ShaderType ) ; // ソスwソス阮シソスフシソスFソス[ソス_ソス[ソスソスヌみ搾ソスソスソス +extern int Live2DCubism4_SetupShaderCode( int *ShaderCodeBinConvert, BYTE *ShaderCodeBin ) ; // シェーダーDXAファイルのセットアップ +extern int Live2DCubism4_LoadShaderCode( const char *ShaderName, int ShaderType ) ; // 指定名のシェーダーを読み込む -extern void Live2DCubism4_InitLoadModelGParam( LIVE2DCUBISM4_LOADMODEL_GPARAM *GParam ) ; // LIVE2DCUBISM4_LOADMODEL_GPARAM ソスフデソス[ソス^ソスソスソスZソスbソスgソスソスソスソス +extern void Live2DCubism4_InitLoadModelGParam( LIVE2DCUBISM4_LOADMODEL_GPARAM *GParam ) ; // LIVE2DCUBISM4_LOADMODEL_GPARAM のデータをセットする -extern int Live2DCubism4_LoadModel_UseGParam( LIVE2DCUBISM4_LOADMODEL_GPARAM *GParam, const wchar_t *FilePath, int ASyncLoadFlag = FALSE, int ASyncThread = FALSE ) ; // Live2D_LoadModel ソスフグソスソスソス[ソスoソスソスソスマ撰ソスソスノアソスNソスZソスXソスソスソスネゑソスソスoソス[ソスWソスソスソスソス +extern int Live2DCubism4_LoadModel_UseGParam( LIVE2DCUBISM4_LOADMODEL_GPARAM *GParam, const wchar_t *FilePath, int ASyncLoadFlag = FALSE, int ASyncThread = FALSE ) ; // Live2D_LoadModel のグローバル変数にアクセスしないバージョン -// wchar_tソスナ関撰ソス +// wchar_t版関数 extern int Live2D_SetCubism4CoreDLLPath_WCHAR_T( const wchar_t *CoreDLLFilePath ) ; extern int Live2D_LoadModel_WCHAR_T( const wchar_t *FilePath ) ; extern int Live2D_Model_StartMotion_WCHAR_T( int Live2DModelHandle, const wchar_t *group, int no ) ; @@ -302,13 +304,13 @@ extern float Live2D_Model_GetMotionFadeOutTimeValue_WCHAR_T( int Live2DModelHan -// ソスツ具ソスソスヒ托ソスソスヨ撰ソス -extern int Live2DCubism4_Initialize_PF( void ) ; // Live2D Cubism4 ソスヨ連ソスフ擾ソスソスソスソスソスソスソスソスソスヨ撰ソスソスフ環具ソスソスヒ托ソスソスソスソスソスソスソスソスsソスソスソスヨ撰ソス -extern int Live2DCubism4_Terminate_PF( void ) ; // Live2D Cubism4 ソスヨ連ソスフ鯉ソスnソスソスソスソスソスソスソスソスヨ撰ソスソスフ環具ソスソスヒ托ソスソスソスソスソスソスソスソスsソスソスソスヨ撰ソス +// 環境依存関数 +extern int Live2DCubism4_Initialize_PF( void ) ; // Live2D Cubism4 関連の初期化する関数の環境依存処理を行う関数 +extern int Live2DCubism4_Terminate_PF( void ) ; // Live2D Cubism4 関連の後始末をする関数の環境依存処理を行う関数 -extern int Live2DCubism4_GenerateShaders_PF( void ) ; // Live2D Cubism4 ソスフシソスFソス[ソス_ソス[ソス成ソスフ環具ソスソスヒ托ソスソスソスソスソスソスソスソスsソスソス -extern int Live2DCubism4_SetupShader_PF( int ConstantBufferHandle, D_CubismConstantBufferDxLib *ConstantBuffer, D_ShaderNames VertexShader, D_ShaderNames PixelShader ) ; // Live2D Cubism4 ソスフシソスFソス[ソス_ソス[ソスフセソスbソスgソスAソスbソスvソスソスソスsソスソス -extern int Live2DCubism4_DrawAfter_PF( void ) ; // Live2D Cubism4 ソスフ描ソスソスフ鯉ソスノ呼ばゑソスソスツ具ソスソスヒ托ソスソスヨ撰ソス +extern int Live2DCubism4_GenerateShaders_PF( void ) ; // Live2D Cubism4 のシェーダー作成の環境依存処理を行う +extern int Live2DCubism4_SetupShader_PF( int ConstantBufferHandle, D_CubismConstantBufferDxLib *ConstantBuffer, D_ShaderNames VertexShader, D_ShaderNames PixelShader ) ; // Live2D Cubism4 のシェーダーのセットアップを行う +extern int Live2DCubism4_DrawAfter_PF( void ) ; // Live2D Cubism4 の描画の後に呼ばれる環境依存関数 diff --git a/DxLog.cpp b/DxLog.cpp index aae185b..f0c8096 100644 --- a/DxLog.cpp +++ b/DxLog.cpp @@ -2,7 +2,7 @@ // // DXライブラリ ログプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxLog.h b/DxLog.h index 4659219..e6e4189 100644 --- a/DxLog.h +++ b/DxLog.h @@ -2,7 +2,7 @@ // // DXライブラリ ログプログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxLog.txt b/DxLog.txt index 934ebb1..1aa9ba8 100644 --- a/DxLog.txt +++ b/DxLog.txt @@ -3,9 +3,71 @@ // DXライブラリ 非公式ログ // // Creator : 山田 巧 -// Last Access : 2020/5/10 +// Last Access : 2020/8/23 // ============================================================================ +Ver 3.22a  正式公開のためにバージョン番号を変更。 +Ver 3.22  ReadSoftSoundData, WriteSoftSoundData を量子化ビット深度 + 24bitのサウンドデータに対応。 +  DrawCubeSet3D で引数 FillFlag を FALSE にするとメモリの不正な + アクセスが発生してしまうバグを修正。 +  DrawCube3D と DrawCubeSet3D で FillFlag を FALSE にすると + ライティングが有効になっている場合、DifColor の色の指定に + 関わらず真っ黒な線が描画されてしまうバグを修正。 +  GraphBlend の DX_GRAPH_BLEND_RGBA_SELECT_MIX で指定できる + 色成分に DX_RGBA_SELECT_SRC_INV_R などの反転要素を追加。 +  GraphFilter に色の置換を行うためのフィルター + DX_GRAPH_FILTER_REPLACEMENT を追加。 +  Windows版:InputString 等の文字列入力関数が Windows10 環境で + 全角文字を入力すると、半角文字も一緒に入力されてしまう + 不具合を修正。 +  BMP形式の一部のピクセルフォーマットの画像が正常に読み込め + ないバグを修正。 +  Windows版:Direct3D 11 で使用するアダプター( GPU )を + 指定するための関数 SetUseDirect3D11AdapterIndex を追加。 +  Windows版:プログラム実行途中で ChangeWindowMode を使用して + フルスクリーンモードからウィンドウモードに変更をすると + ウィンドウの位置やサイズが正常ではなくなってしまうバグを修正。 +  Windows版:画面のDPI設定を100%より大きな値にしている場合に + フルスクリーンモードで起動した後、ウィンドウモードに変更すると + 小さいウィンドウで表示されてしまう不具合を修正。 +  CreateMaskScreen を呼び出したあと、DrawString で描画される + 文字の下端が描画されない場合があったり、DrawRoundRectAA で + 正常な描画が行われなかったりするバグを修正。 +  指定のマテリアルのサブディフューズマップテクスチャを設定、 + 取得する為の関数 MV1SetMaterialSubDifMapTexture と + MV1GetMaterialSubDifMapTexture を追加。 +  GetDrawExtendStringSize の ExRateX や ExRateY に 1.0 以外の + 値を渡すと SizeY で取得できる縦サイズが正しい値ではなくなる + バグを修正。 +  DxLibModelViewer.exe で fbxファイルを読み込んだ際に + 従法線( Binormal )と接線( Tangent )が正常に読み込めない + 事があるバグを修正。 +  シャドウマップへの描画の場合はトゥーンレンダリングの輪郭線を + 描画しないように処理を変更。 +  Ogg Vorbis ファイルのコメントの数を取得する為の関数 + GetOggCommentNum と、コメントの内容を取得する為の関数 + GetOggComment を追加。 +  Windows版:メインウィンドウの最大化ボタンを押した時の挙動を + 設定する関数 SetWindowMaximizeButtonBehavior と、 + SetWindowMaximizeButtonBehavior( 1 ); の設定の際に + 最大化ボタンが押されたかどうかを判定するための関数 + CheckWindowMaximizeButtonInput を追加。 +  Windows版:IME入力を有効な状態では Escキー、BackSpaceキー、 + Enterキーが効かなくなっていたバグを修正。 +  グラフィックハンドルの最大数を 32768 から 262144 に増量。 +  Live2D_Model_Draw による Live2Dモデルの描画の後、 + MV1DrawModel を実行しても3Dモデルが描画されないバグを修正。 +  3Dモデルのマテリアルにサブテクスチャが設定されていた場合、 + サブではないテクスチャの透明な部分はサブテクスチャの透明度と + 関係なく透明になってしまっていたバグを修正。 +  GraphFilterBlt と GraphBlendBlt で引数 DestGrHandle に + DX_SCREEN_BACK を指定すると裏画面に結果を出力できる仕様を追加。 +  SetCurrentPositionSoundMem 等で新しい再生位置としてサウンド + データのサイズ以上の位置を指定した場合メモリの不正なアクセスが + 発生してしまう事があるバグを修正。 +  GraphFilterBlt や GraphBlendBlt の結果を転送先に転送する際の + ブレンドモードを設定する為の関数 SetGraphFilterBltBlendMode を追加。 Ver 3.21f  正式公開のためにバージョン番号を変更。 Ver 3.21e  符号付き24bitの WAVファイルが正常に再生できないバグを修正。  同じサウンドハンドルを連続して PlaySoundMem を呼び続けると diff --git a/DxMask.cpp b/DxMask.cpp index 3d369d5..8f33723 100644 --- a/DxMask.cpp +++ b/DxMask.cpp @@ -2,7 +2,7 @@ // // DXライブラリ マスクデータ管理プログラム // -// Ver 3.21f +// Ver 3.22a // //----------------------------------------------------------------------------- diff --git a/DxMask.h b/DxMask.h index 1b99975..e905fe8 100644 --- a/DxMask.h +++ b/DxMask.h @@ -2,7 +2,7 @@ // // DXライブラリ マスク処理ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMath.cpp b/DxMath.cpp index 7963619..c5ff74f 100644 --- a/DxMath.cpp +++ b/DxMath.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 演算プログラム // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- diff --git a/DxMath.h b/DxMath.h index 91fef21..4591933 100644 --- a/DxMath.h +++ b/DxMath.h @@ -2,7 +2,7 @@ // // DXライブラリ 演算プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMemImg.cpp b/DxMemImg.cpp index 1a000d0..dc4a1db 100644 --- a/DxMemImg.cpp +++ b/DxMemImg.cpp @@ -2,7 +2,7 @@ // // DXライブラリ メモリイメージ制御用プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMemImg.h b/DxMemImg.h index 14f8da8..03d3e4d 100644 --- a/DxMemImg.h +++ b/DxMemImg.h @@ -2,7 +2,7 @@ // // DXライブラリ メモリイメージ制御用ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMemImgDrawFunction0.cpp b/DxMemImgDrawFunction0.cpp index a032392..7818aad 100644 --- a/DxMemImgDrawFunction0.cpp +++ b/DxMemImgDrawFunction0.cpp @@ -2,7 +2,7 @@ // // DXライブラリ メモリイメージ制御用プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMemImgDrawFunction1.cpp b/DxMemImgDrawFunction1.cpp index 619f228..d83756b 100644 --- a/DxMemImgDrawFunction1.cpp +++ b/DxMemImgDrawFunction1.cpp @@ -2,7 +2,7 @@ // // DXライブラリ メモリイメージ制御用プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMemImgDrawFunction2.cpp b/DxMemImgDrawFunction2.cpp index 25c8371..1f7823d 100644 --- a/DxMemImgDrawFunction2.cpp +++ b/DxMemImgDrawFunction2.cpp @@ -2,7 +2,7 @@ // // DXライブラリ メモリイメージ制御用プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMemImgDrawFunction3.cpp b/DxMemImgDrawFunction3.cpp index 18db182..c2b5194 100644 --- a/DxMemImgDrawFunction3.cpp +++ b/DxMemImgDrawFunction3.cpp @@ -2,7 +2,7 @@ // // DXライブラリ メモリイメージ制御用プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMemory.cpp b/DxMemory.cpp index 47d52aa..9e6bc91 100644 --- a/DxMemory.cpp +++ b/DxMemory.cpp @@ -2,7 +2,7 @@ // // DXライブラリ メモリ関連プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMemory.h b/DxMemory.h index 2db7007..2da0765 100644 --- a/DxMemory.h +++ b/DxMemory.h @@ -2,7 +2,7 @@ // // DXライブラリ メモリ関係プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModel.cpp b/DxModel.cpp index d40d193..1f94394 100644 --- a/DxModel.cpp +++ b/DxModel.cpp @@ -2,7 +2,7 @@ // // DXライブラリ モデルデータ制御プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -10921,6 +10921,63 @@ extern int MV1GetMaterialDifMapTextureBase( int MBHandle, int MaterialIndex ) return Material->DiffuseLayer[ 0 ].Texture ; } +// 指定のマテリアルでサブディフューズマップとして使用するテクスチャを指定する +extern int MV1SetMaterialSubDifMapTextureBase( int MBHandle, int MaterialIndex, int TexIndex ) +{ + MV1_MODEL *Model ; + MV1_MESH_BASE * MBMesh ; + MV1_MESH *Mesh ; + int i ; + + MV1BASEMATERIALSTART( MBHandle, ModelBase, Material, MaterialIndex, -1 ) ; + + if( TexIndex < 0 || TexIndex >= ModelBase->TextureNum ) + return -1 ; + + // 描画待機している描画物を描画 + DRAWSTOCKINFO + + // 今までディフューズマップが2以下の場合は2にする + if( Material->DiffuseLayerNum < 2 ) + { + Material->DiffuseLayerNum = 2 ; + } + + // 設定 + Material->DiffuseLayer[ 1 ].Texture = TexIndex ; + + // このマテリアルを使用しているメッシュのセットアップ完了フラグを倒す + MBMesh = ModelBase->Mesh ; + for( i = 0 ; i < ModelBase->MeshNum ; i ++, MBMesh ++ ) + { + if( MBMesh->Material != Material ) continue ; + + for( Model = ModelBase->UseFirst ; Model ; Model = Model->UseBaseDataNext ) + { + Mesh = &Model->Mesh[ i ] ; + MV1MESH_RESET_SEMITRANSSETUP( Mesh ) + + // マテリアル情報も更新 + if( MV1CCHK( Mesh->DrawMaterialChange ) == 0 ) + MV1BitSetChange( &Mesh->DrawMaterialChange ) ; + } + } + + // 終了 + return 0 ; +} + +// 指定のマテリアルでサブディフューズマップとして使用されているテクスチャのインデックスを取得する +extern int MV1GetMaterialSubDifMapTextureBase( int MBHandle, int MaterialIndex ) +{ + MV1BASEMATERIALSTART( MBHandle, ModelBase, Material, MaterialIndex, -1 ) ; + + if( Material->DiffuseLayerNum == 0 ) + return -1 ; + + return Material->DiffuseLayer[ 0 ].Texture ; +} + // 指定のマテリアルでスペキュラマップとして使用するテクスチャを指定する extern int MV1SetMaterialSpcMapTextureBase( int MBHandle, int MaterialIndex, int TexIndex ) { @@ -24760,6 +24817,60 @@ extern int NS_MV1GetMaterialDifMapTexture( int MHandle, int MaterialIndex ) return Material->DiffuseLayer[ 0 ].Texture ; } +// 指定のマテリアルでサブディフューズマップとして使用するテクスチャを指定する +extern int NS_MV1SetMaterialSubDifMapTexture( int MHandle, int MaterialIndex, int TexIndex ) +{ + MV1_MESH *Mesh ; + int i ; + + MV1MATERIALSTART( MHandle, Model, ModelBase, Material, MaterialIndex, -1 ) ; + + if( TexIndex < 0 || TexIndex >= ModelBase->TextureNum ) + return -1 ; + + if( Material->DiffuseLayerNum > 1 && Material->DiffuseLayer[ 1 ].Texture == TexIndex ) + { + return 0 ; + } + + // 描画待機している描画物を描画 + DRAWSTOCKINFO + + // ディフューズレイヤーが2以下の場合は2にする + if( Material->DiffuseLayerNum < 2 ) + { + Material->DiffuseLayerNum = 2 ; + } + + // 設定 + Material->DiffuseLayer[ 1 ].Texture = TexIndex ; + + // このマテリアルを使用しているメッシュの半透明要素有無情報のセットアップ完了フラグを倒す + Mesh = Model->Mesh ; + for( i = 0 ; i < ModelBase->MeshNum ; i ++, Mesh ++ ) + { + if( Mesh->Material != Material ) continue ; + + MV1MESH_RESET_SEMITRANSSETUP( Mesh ) + if( MV1CCHK( Mesh->DrawMaterialChange ) == 0 ) + MV1BitSetChange( &Mesh->DrawMaterialChange ) ; + } + + // 終了 + return 0 ; +} + +// 指定のマテリアルでサブディフューズマップとして使用されているテクスチャのインデックスを取得する +extern int NS_MV1GetMaterialSubDifMapTexture( int MHandle, int MaterialIndex ) +{ + MV1MATERIALSTART( MHandle, Model, ModelBase, Material, MaterialIndex, -1 ) ; + + if( Material->DiffuseLayerNum < 2 ) + return -1 ; + + return Material->DiffuseLayer[ 1 ].Texture ; +} + // 指定のマテリアルでスペキュラマップとして使用するテクスチャを指定する extern int NS_MV1SetMaterialSpcMapTexture( int MHandle, int MaterialIndex, int TexIndex ) { diff --git a/DxModel.h b/DxModel.h index 5c6afe1..e05bbe9 100644 --- a/DxModel.h +++ b/DxModel.h @@ -2,7 +2,7 @@ // // DXライブラリ モデルデータ制御プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -1665,6 +1665,8 @@ extern int MV1CreateTextureColorBaseImage( extern float MV1GetMaterialSpcPowerBase( int MBHandle, int MaterialIndex ) ; // 指定のマテリアルのスペキュラの強さを取得する extern int MV1SetMaterialDifMapTextureBase( int MBHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでディフューズマップとして使用するテクスチャを指定する extern int MV1GetMaterialDifMapTextureBase( int MBHandle, int MaterialIndex ) ; // 指定のマテリアルでディフューズマップとして使用されているテクスチャのインデックスを取得する +extern int MV1SetMaterialSubDifMapTextureBase( int MBHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでサブディフューズマップとして使用するテクスチャを指定する +extern int MV1GetMaterialSubDifMapTextureBase( int MBHandle, int MaterialIndex ) ; // 指定のマテリアルでサブディフューズマップとして使用されているテクスチャのインデックスを取得する extern int MV1SetMaterialSpcMapTextureBase( int MBHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでスペキュラマップとして使用するテクスチャを指定する extern int MV1GetMaterialSpcMapTextureBase( int MBHandle, int MaterialIndex ) ; // 指定のマテリアルでスペキュラマップとして使用されているテクスチャのインデックスを取得する extern int MV1SetMaterialNormalMapTextureBase( int MBHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルで法線マップとして使用するテクスチャを指定する @@ -2406,6 +2408,8 @@ extern const wchar_t * MV1GetShapeName_WCHAR_T( int MHandle, int ShapeIndex ) extern float NS_MV1GetMaterialSpcPower( int MHandle, int MaterialIndex ) ; // 指定のマテリアルのスペキュラの強さを取得する extern int NS_MV1SetMaterialDifMapTexture( int MHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでディフューズマップとして使用するテクスチャを指定する extern int NS_MV1GetMaterialDifMapTexture( int MHandle, int MaterialIndex ) ; // 指定のマテリアルでディフューズマップとして使用されているテクスチャのインデックスを取得する +extern int NS_MV1SetMaterialSubDifMapTexture( int MHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでサブディフューズマップとして使用するテクスチャを指定する +extern int NS_MV1GetMaterialSubDifMapTexture( int MHandle, int MaterialIndex ) ; // 指定のマテリアルでサブディフューズマップとして使用されているテクスチャのインデックスを取得する extern int NS_MV1SetMaterialSpcMapTexture( int MHandle, int MaterialIndex, int TexIndex ) ; // 指定のマテリアルでスペキュラマップとして使用するテクスチャを指定する extern int NS_MV1GetMaterialSpcMapTexture( int MHandle, int MaterialIndex ) ; // 指定のマテリアルでスペキュラマップとして使用されているテクスチャのインデックスを取得する extern int NS_MV1GetMaterialNormalMapTexture( int MHandle, int MaterialIndex ) ; // 指定のマテリアルで法線マップとして使用されているテクスチャのインデックスを取得する @@ -2782,6 +2786,8 @@ extern const wchar_t * MV1GetShapeName_WCHAR_T( int MHandle, int ShapeIndex ) #define NS_MV1GetMaterialSpcPower MV1GetMaterialSpcPower #define NS_MV1SetMaterialDifMapTexture MV1SetMaterialDifMapTexture #define NS_MV1GetMaterialDifMapTexture MV1GetMaterialDifMapTexture +#define NS_MV1SetMaterialSubDifMapTexture MV1SetMaterialSubDifMapTexture +#define NS_MV1GetMaterialSubDifMapTexture MV1GetMaterialSubDifMapTexture #define NS_MV1SetMaterialSpcMapTexture MV1SetMaterialSpcMapTexture #define NS_MV1GetMaterialSpcMapTexture MV1GetMaterialSpcMapTexture #define NS_MV1GetMaterialNormalMapTexture MV1GetMaterialNormalMapTexture diff --git a/DxModelFile.h b/DxModelFile.h index acfe5e8..148c3d0 100644 --- a/DxModelFile.h +++ b/DxModelFile.h @@ -2,7 +2,7 @@ // // DXライブラリ モデルデータファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelLoader0.cpp b/DxModelLoader0.cpp index 4deab3e..510095a 100644 --- a/DxModelLoader0.cpp +++ b/DxModelLoader0.cpp @@ -2,7 +2,7 @@ // // DXライブラリ Xファイル読み込みプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelLoader1.cpp b/DxModelLoader1.cpp index b6e02de..99cf824 100644 --- a/DxModelLoader1.cpp +++ b/DxModelLoader1.cpp @@ -2,7 +2,7 @@ // // DXライブラリ FBXモデルデータ読み込みプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -308,7 +308,11 @@ static int AnalyseFbxNode( MV1_MODEL_R *RModel, FBX_MODEL *Model, MV1_FRAME_R *P MV1_SHAPE_VERTEX_R *ShapeVert ; VECTOR *MeshPos ; MATRIX ReverseMat ; - int i, j, k, l, Num, LayerNum, Index, MaterialNum ; + int i, j, k, l, Num, LayerNum, Index, IndexNum, MaterialNum ; + VECTOR *WorkNormals, *WorkBinormals, *WorkTangents ; + int NormalNum, NormalIndexNum ; + int BinormalNum, BinormalIndexNum ; + int TangentNum, TangentIndexNum ; char UTF16LE_Buffer[ 1024 ] ; // FbxNode が NULL だったらトップノードをセットアップする @@ -416,6 +420,7 @@ static int AnalyseFbxNode( MV1_MODEL_R *RModel, FBX_MODEL *Model, MV1_FRAME_R *P // 面の情報を取得 MeshFace = Mesh->Faces ; + IndexNum = 0 ; for( i = 0 ; i < ( int )Mesh->FaceNum ; i ++, MeshFace ++ ) { // インデックスの数を取得 @@ -430,6 +435,9 @@ static int AnalyseFbxNode( MV1_MODEL_R *RModel, FBX_MODEL *Model, MV1_FRAME_R *P MeshFace = Mesh->Faces + i ; } + // インデックスの数を加算 + IndexNum += MeshFace->IndexNum ; + // インデックスを取得 for( j = 0 ; j < ( int )MeshFace->IndexNum ; j ++ ) { @@ -474,95 +482,199 @@ static int AnalyseFbxNode( MV1_MODEL_R *RModel, FBX_MODEL *Model, MV1_FRAME_R *P FbxRefMode = FbxNormalElem->GetReferenceMode() ; FbxMappingMode = FbxNormalElem->GetMappingMode() ; - switch( FbxRefMode ) + // 法線情報の数をセット + Mesh->NormalNum = IndexNum ; + + // 法線情報を格納するメモリ領域の確保 + Mesh->Normals = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * IndexNum, &RModel->Mem ) ; + if( Mesh->Normals == NULL ) { - case FbxGeometryElement::eDirect : - // 法線情報の数を取得 - Mesh->NormalNum = FbxNormalElem->GetDirectArray().GetCount() ; + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\xd5\x6c\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 法線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; + return -1 ; + } + + // 法線情報の数を取得 + NormalNum = FbxNormalElem->GetDirectArray().GetCount() ; - // 法線情報を格納するメモリ領域の確保 - Mesh->Normals = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * Mesh->NormalNum, &RModel->Mem ) ; - if( Mesh->Normals == NULL ) + // インデックスの数を取得 + NormalIndexNum = FbxNormalElem->GetIndexArray().GetCount() ; + + // 法線のインデックスをセット + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k++ ) { - DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\xd5\x6c\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 法線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; - return -1 ; + MeshFace->NormalIndex[ l ] = k ; } + } - // 直接モードの場合はそのまま代入 - for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) + switch( FbxRefMode ) + { + case FbxGeometryElement::eDirect : +// // 直接モードの場合はそのまま代入 +// for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) +// { +// Mesh->Normals[ j ].x = ( float ) FbxNormalElem->GetDirectArray().GetAt( j )[ 0 ] ; +// Mesh->Normals[ j ].y = ( float ) FbxNormalElem->GetDirectArray().GetAt( j )[ 1 ] ; +// Mesh->Normals[ j ].z = ( float )-FbxNormalElem->GetDirectArray().GetAt( j )[ 2 ] ; +// } + + // 面の各頂点に対応する法線の情報を取得 + switch( FbxMappingMode ) { - Mesh->Normals[ j ].x = ( float ) FbxNormalElem->GetDirectArray().GetAt( j )[ 0 ] ; - Mesh->Normals[ j ].y = ( float ) FbxNormalElem->GetDirectArray().GetAt( j )[ 1 ] ; - Mesh->Normals[ j ].z = ( float )-FbxNormalElem->GetDirectArray().GetAt( j )[ 2 ] ; + case FbxGeometryElement::eByControlPoint : + // 法線インデックスは頂点インデックスと等しくなる + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k++ ) + { + Index = MeshFace->VertexIndex[ l ] ; + if( Index < NormalNum ) + { + Mesh->Normals[ k ].x = ( float ) FbxNormalElem->GetDirectArray().GetAt( Index )[ 0 ] ; + Mesh->Normals[ k ].y = ( float ) FbxNormalElem->GetDirectArray().GetAt( Index )[ 1 ] ; + Mesh->Normals[ k ].z = ( float )-FbxNormalElem->GetDirectArray().GetAt( Index )[ 2 ] ; + } + } + } + break ; + + case FbxGeometryElement::eByPolygonVertex : + // 法線インデックスは別個で存在する + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k ++ ) + { + if( k < NormalNum ) + { + Mesh->Normals[ k ].x = ( float ) FbxNormalElem->GetDirectArray().GetAt( k )[ 0 ] ; + Mesh->Normals[ k ].y = ( float ) FbxNormalElem->GetDirectArray().GetAt( k )[ 1 ] ; + Mesh->Normals[ k ].z = ( float )-FbxNormalElem->GetDirectArray().GetAt( k )[ 2 ] ; + } + } + } + break ; + + default : + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\xd5\x6c\xda\x7d\xde\x30\xc3\x30\xd4\x30\xf3\x30\xb0\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の法線マッピングモードが使用されていました\n" @*/ )) ; + return -1 ; } break ; case FbxGeometryElement::eIndexToDirect : - // インデックスの数を取得 - Mesh->NormalNum = FbxNormalElem->GetIndexArray().GetCount() ; - - // 法線情報を格納するメモリ領域の確保 - Mesh->Normals = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * Mesh->NormalNum, &RModel->Mem ) ; - if( Mesh->Normals == NULL ) + // インデックスモードの場合は法線テーブルを作成する + WorkNormals = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * NormalIndexNum, &RModel->Mem ) ; + if( WorkNormals == NULL ) { - DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\xd5\x6c\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 法線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5c\x4f\x6d\x69\x28\x75\x6e\x30\xd5\x6c\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 作業用の法線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; return -1 ; } - // インデックスモードの場合は間接参照代入 - for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) + // 法線テーブルの作成 + for( j = 0 ; j < NormalIndexNum ; j ++ ) { Index = FbxNormalElem->GetIndexArray().GetAt( j ) ; - Mesh->Normals[ j ].x = ( float ) FbxNormalElem->GetDirectArray().GetAt( Index )[ 0 ] ; - Mesh->Normals[ j ].y = ( float ) FbxNormalElem->GetDirectArray().GetAt( Index )[ 1 ] ; - Mesh->Normals[ j ].z = ( float )-FbxNormalElem->GetDirectArray().GetAt( Index )[ 2 ] ; - } - break ; - - default : - DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\xd5\x6c\xda\x7d\xea\x30\xd5\x30\xa1\x30\xec\x30\xf3\x30\xb9\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の法線リファレンスモードが使用されていました\n" @*/ )) ; - return -1 ; - } - - // 面の各頂点に対応する法線の情報を取得 - switch( FbxMappingMode ) - { - case FbxGeometryElement::eByControlPoint : - // 法線インデックスは頂点インデックスと等しくなる - MeshFace = Mesh->Faces ; - for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) - { - MeshFace->NormalIndex[ 0 ] = MeshFace->VertexIndex[ 0 ] ; - MeshFace->NormalIndex[ 1 ] = MeshFace->VertexIndex[ 1 ] ; - MeshFace->NormalIndex[ 2 ] = MeshFace->VertexIndex[ 2 ] ; - MeshFace->NormalIndex[ 3 ] = MeshFace->VertexIndex[ 3 ] ; + WorkNormals[ j ].x = ( float ) FbxNormalElem->GetDirectArray().GetAt( Index )[ 0 ] ; + WorkNormals[ j ].y = ( float ) FbxNormalElem->GetDirectArray().GetAt( Index )[ 1 ] ; + WorkNormals[ j ].z = ( float )-FbxNormalElem->GetDirectArray().GetAt( Index )[ 2 ] ; } - break ; - case FbxGeometryElement::eByPolygonVertex : - // 法線インデックスは別個で存在する - MeshFace = Mesh->Faces ; - k = 0 ; - for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + // 面の各頂点に対応する法線の情報を取得 + switch( FbxMappingMode ) { - for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++ ) + case FbxGeometryElement::eByControlPoint : + // 法線インデックスは頂点インデックスと等しくなる + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) { - MeshFace->NormalIndex[ l ] = k ; - k ++ ; + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k++ ) + { + Index = MeshFace->VertexIndex[ l ] ; + if( Index < NormalIndexNum ) + { + Mesh->Normals[ k ].x = ( float ) WorkNormals[ Index ].x ; + Mesh->Normals[ k ].y = ( float ) WorkNormals[ Index ].y ; + Mesh->Normals[ k ].z = ( float )-WorkNormals[ Index ].z ; + } + } + } + break ; - // 法泉の数が足りないバグデータの対応 - if( k == Mesh->NormalNum ) + case FbxGeometryElement::eByPolygonVertex : + // 法線インデックスは別個で存在する + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k ++ ) { - k = 0 ; + if( k < NormalIndexNum ) + { + Mesh->Normals[ k ].x = ( float ) WorkNormals[ k ].x ; + Mesh->Normals[ k ].y = ( float ) WorkNormals[ k ].y ; + Mesh->Normals[ k ].z = ( float )-WorkNormals[ k ].z ; + } } } + break ; + + default : + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\xd5\x6c\xda\x7d\xde\x30\xc3\x30\xd4\x30\xf3\x30\xb0\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の法線マッピングモードが使用されていました\n" @*/ )) ; + return -1 ; } break ; default : - DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\xd5\x6c\xda\x7d\xde\x30\xc3\x30\xd4\x30\xf3\x30\xb0\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の法線マッピングモードが使用されていました\n" @*/ )) ; + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\xd5\x6c\xda\x7d\xea\x30\xd5\x30\xa1\x30\xec\x30\xf3\x30\xb9\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の法線リファレンスモードが使用されていました\n" @*/ )) ; return -1 ; } + +// // 面の各頂点に対応する法線の情報を取得 +// switch( FbxMappingMode ) +// { +// case FbxGeometryElement::eByControlPoint : +// // 法線インデックスは頂点インデックスと等しくなる +// MeshFace = Mesh->Faces ; +// for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) +// { +// MeshFace->NormalIndex[ 0 ] = MeshFace->VertexIndex[ 0 ] ; +// MeshFace->NormalIndex[ 1 ] = MeshFace->VertexIndex[ 1 ] ; +// MeshFace->NormalIndex[ 2 ] = MeshFace->VertexIndex[ 2 ] ; +// MeshFace->NormalIndex[ 3 ] = MeshFace->VertexIndex[ 3 ] ; +// } +// break ; +// +// case FbxGeometryElement::eByPolygonVertex : +// // 法線インデックスは別個で存在する +// MeshFace = Mesh->Faces ; +// k = 0 ; +// for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) +// { +// for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++ ) +// { +// MeshFace->NormalIndex[ l ] = k ; +// k ++ ; +// +// // 法泉の数が足りないバグデータの対応 +// if( k == Mesh->NormalNum ) +// { +// k = 0 ; +// } +// } +// } +// break ; +// +// default : +// DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\xd5\x6c\xda\x7d\xde\x30\xc3\x30\xd4\x30\xf3\x30\xb0\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の法線マッピングモードが使用されていました\n" @*/ )) ; +// return -1 ; +// } } // 従法線エレメントの数だけ繰り返し @@ -574,54 +686,147 @@ static int AnalyseFbxNode( MV1_MODEL_R *RModel, FBX_MODEL *Model, MV1_FRAME_R *P FbxRefMode = FbxBinormalElem->GetReferenceMode() ; FbxMappingMode = FbxBinormalElem->GetMappingMode() ; + // 従法線情報を格納するメモリ領域の確保 + Mesh->Binormals = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * IndexNum, &RModel->Mem ) ; + if( Mesh->Binormals == NULL ) + { + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x93\x5f\xd5\x6c\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 従法線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; + return -1 ; + } + + // 従法線情報の数を取得 + BinormalNum = FbxBinormalElem->GetDirectArray().GetCount() ; + + // 従法線インデックスの数を取得 + BinormalIndexNum = FbxBinormalElem->GetIndexArray().GetCount() ; + switch( FbxRefMode ) { case FbxGeometryElement::eDirect : - // 従法線情報の数が法線情報の数と異なっていたら無視 - if( Mesh->NormalNum != FbxBinormalElem->GetDirectArray().GetCount() ) +// // 直接モードの場合はそのまま代入 +// for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) +// { +// Mesh->Binormals[ j ].x = ( float ) FbxBinormalElem->GetDirectArray().GetAt( j )[ 0 ] ; +// Mesh->Binormals[ j ].y = ( float ) FbxBinormalElem->GetDirectArray().GetAt( j )[ 1 ] ; +// Mesh->Binormals[ j ].z = ( float )-FbxBinormalElem->GetDirectArray().GetAt( j )[ 2 ] ; +// } + + // 面の各頂点に対応する従法線の情報を取得 + switch( FbxMappingMode ) { - continue ; - } + case FbxGeometryElement::eByControlPoint : + // 従法線インデックスは頂点インデックスと等しくなる + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k++ ) + { + Index = MeshFace->VertexIndex[ l ] ; + if( Index < BinormalNum ) + { + Mesh->Binormals[ k ].x = ( float ) FbxBinormalElem->GetDirectArray().GetAt( Index )[ 0 ] ; + Mesh->Binormals[ k ].y = ( float ) FbxBinormalElem->GetDirectArray().GetAt( Index )[ 1 ] ; + Mesh->Binormals[ k ].z = ( float )-FbxBinormalElem->GetDirectArray().GetAt( Index )[ 2 ] ; + } + } + } + break ; - // 従法線情報を格納するメモリ領域の確保 - Mesh->Binormals = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * Mesh->NormalNum, &RModel->Mem ) ; - if( Mesh->Binormals == NULL ) - { - DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x93\x5f\xd5\x6c\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 従法線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; - return -1 ; - } + case FbxGeometryElement::eByPolygonVertex : + // 従法線インデックスは別個で存在する + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k ++ ) + { + if( k < BinormalNum ) + { + Mesh->Binormals[ k ].x = ( float ) FbxBinormalElem->GetDirectArray().GetAt( k )[ 0 ] ; + Mesh->Binormals[ k ].y = ( float ) FbxBinormalElem->GetDirectArray().GetAt( k )[ 1 ] ; + Mesh->Binormals[ k ].z = ( float )-FbxBinormalElem->GetDirectArray().GetAt( k )[ 2 ] ; + } + } + } + break ; - // 直接モードの場合はそのまま代入 - for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) - { - Mesh->Binormals[ j ].x = ( float ) FbxBinormalElem->GetDirectArray().GetAt( j )[ 0 ] ; - Mesh->Binormals[ j ].y = ( float ) FbxBinormalElem->GetDirectArray().GetAt( j )[ 1 ] ; - Mesh->Binormals[ j ].z = ( float )-FbxBinormalElem->GetDirectArray().GetAt( j )[ 2 ] ; + default : + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\x93\x5f\xd5\x6c\xda\x7d\xde\x30\xc3\x30\xd4\x30\xf3\x30\xb0\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の従法線マッピングモードが使用されていました\n" @*/ )) ; + return -1 ; } break ; case FbxGeometryElement::eIndexToDirect : - // インデックスの数が法線情報の数と異なっていたら無視 - if( Mesh->NormalNum != FbxBinormalElem->GetIndexArray().GetCount() ) +// // インデックスモードの場合は間接参照代入 +// for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) +// { +// Index = FbxBinormalElem->GetIndexArray().GetAt( j ) ; +// Mesh->Binormals[ j ].x = ( float ) FbxBinormalElem->GetDirectArray().GetAt( Index )[ 0 ] ; +// Mesh->Binormals[ j ].y = ( float ) FbxBinormalElem->GetDirectArray().GetAt( Index )[ 1 ] ; +// Mesh->Binormals[ j ].z = ( float )-FbxBinormalElem->GetDirectArray().GetAt( Index )[ 2 ] ; +// } + + // インデックスモードの場合は従法線テーブルを作成する + WorkBinormals = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * BinormalIndexNum, &RModel->Mem ) ; + if( WorkBinormals == NULL ) { - continue ; + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5c\x4f\x6d\x69\x28\x75\x6e\x30\x93\x5f\xd5\x6c\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 作業用の従法線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; + return -1 ; } - // 従法線情報を格納するメモリ領域の確保 - Mesh->Binormals = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * Mesh->NormalNum, &RModel->Mem ) ; - if( Mesh->Binormals == NULL ) + // 従法線テーブルの作成 + for( j = 0 ; j < BinormalIndexNum ; j ++ ) { - DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x93\x5f\xd5\x6c\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 従法線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; - return -1 ; + Index = FbxBinormalElem->GetIndexArray().GetAt( j ) ; + WorkBinormals[ j ].x = ( float ) FbxBinormalElem->GetDirectArray().GetAt( Index )[ 0 ] ; + WorkBinormals[ j ].y = ( float ) FbxBinormalElem->GetDirectArray().GetAt( Index )[ 1 ] ; + WorkBinormals[ j ].z = ( float )-FbxBinormalElem->GetDirectArray().GetAt( Index )[ 2 ] ; } - // インデックスモードの場合は間接参照代入 - for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) + // 面の各頂点に対応する法線の情報を取得 + switch( FbxMappingMode ) { - Index = FbxBinormalElem->GetIndexArray().GetAt( j ) ; - Mesh->Binormals[ j ].x = ( float ) FbxBinormalElem->GetDirectArray().GetAt( Index )[ 0 ] ; - Mesh->Binormals[ j ].y = ( float ) FbxBinormalElem->GetDirectArray().GetAt( Index )[ 1 ] ; - Mesh->Binormals[ j ].z = ( float )-FbxBinormalElem->GetDirectArray().GetAt( Index )[ 2 ] ; + case FbxGeometryElement::eByControlPoint : + // 従法線インデックスは頂点インデックスと等しくなる + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k++ ) + { + Index = MeshFace->VertexIndex[ l ] ; + if( Index < BinormalIndexNum ) + { + Mesh->Binormals[ k ].x = ( float ) WorkBinormals[ Index ].x ; + Mesh->Binormals[ k ].y = ( float ) WorkBinormals[ Index ].y ; + Mesh->Binormals[ k ].z = ( float )-WorkBinormals[ Index ].z ; + } + } + } + break ; + + case FbxGeometryElement::eByPolygonVertex : + // 従法線インデックスは別個で存在する + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k ++ ) + { + if( k < BinormalIndexNum ) + { + Mesh->Binormals[ k ].x = ( float ) WorkBinormals[ k ].x ; + Mesh->Binormals[ k ].y = ( float ) WorkBinormals[ k ].y ; + Mesh->Binormals[ k ].z = ( float )-WorkBinormals[ k ].z ; + } + } + } + break ; + + default : + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\x93\x5f\xd5\x6c\xda\x7d\xde\x30\xc3\x30\xd4\x30\xf3\x30\xb0\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の従法線マッピングモードが使用されていました\n" @*/ )) ; + return -1 ; } break ; @@ -640,54 +845,147 @@ static int AnalyseFbxNode( MV1_MODEL_R *RModel, FBX_MODEL *Model, MV1_FRAME_R *P FbxRefMode = FbxTangentElem->GetReferenceMode() ; FbxMappingMode = FbxTangentElem->GetMappingMode() ; + // 接線情報を格納するメモリ領域の確保 + Mesh->Tangents = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * IndexNum, &RModel->Mem ) ; + if( Mesh->Tangents == NULL ) + { + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\xa5\x63\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 接線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; + return -1 ; + } + + // 接線情報の数を取得 + TangentNum = FbxTangentElem->GetDirectArray().GetCount() ; + + // 接線インデックスの数を取得 + TangentIndexNum = FbxTangentElem->GetIndexArray().GetCount() ; + switch( FbxRefMode ) { case FbxGeometryElement::eDirect : - // 接線情報の数が法線情報の数と異なっていたら無視 - if( Mesh->NormalNum != FbxTangentElem->GetDirectArray().GetCount() ) +// // 直接モードの場合はそのまま代入 +// for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) +// { +// Mesh->Tangents[ j ].x = ( float ) FbxTangentElem->GetDirectArray().GetAt( j )[ 0 ] ; +// Mesh->Tangents[ j ].y = ( float ) FbxTangentElem->GetDirectArray().GetAt( j )[ 1 ] ; +// Mesh->Tangents[ j ].z = ( float )-FbxTangentElem->GetDirectArray().GetAt( j )[ 2 ] ; +// } + + // 面の各頂点に対応する接線の情報を取得 + switch( FbxMappingMode ) { - continue ; - } + case FbxGeometryElement::eByControlPoint : + // 接線インデックスは頂点インデックスと等しくなる + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k++ ) + { + Index = MeshFace->VertexIndex[ l ] ; + if( Index < TangentNum ) + { + Mesh->Tangents[ k ].x = ( float ) FbxTangentElem->GetDirectArray().GetAt( Index )[ 0 ] ; + Mesh->Tangents[ k ].y = ( float ) FbxTangentElem->GetDirectArray().GetAt( Index )[ 1 ] ; + Mesh->Tangents[ k ].z = ( float )-FbxTangentElem->GetDirectArray().GetAt( Index )[ 2 ] ; + } + } + } + break ; - // 接線情報を格納するメモリ領域の確保 - Mesh->Tangents = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * Mesh->NormalNum, &RModel->Mem ) ; - if( Mesh->Tangents == NULL ) - { - DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\xa5\x63\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 接線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; - return -1 ; - } + case FbxGeometryElement::eByPolygonVertex : + // 接線インデックスは別個で存在する + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k ++ ) + { + if( k < TangentNum ) + { + Mesh->Tangents[ k ].x = ( float ) FbxTangentElem->GetDirectArray().GetAt( k )[ 0 ] ; + Mesh->Tangents[ k ].y = ( float ) FbxTangentElem->GetDirectArray().GetAt( k )[ 1 ] ; + Mesh->Tangents[ k ].z = ( float )-FbxTangentElem->GetDirectArray().GetAt( k )[ 2 ] ; + } + } + } + break ; - // 直接モードの場合はそのまま代入 - for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) - { - Mesh->Tangents[ j ].x = ( float ) FbxTangentElem->GetDirectArray().GetAt( j )[ 0 ] ; - Mesh->Tangents[ j ].y = ( float ) FbxTangentElem->GetDirectArray().GetAt( j )[ 1 ] ; - Mesh->Tangents[ j ].z = ( float )-FbxTangentElem->GetDirectArray().GetAt( j )[ 2 ] ; + default : + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\xa5\x63\xda\x7d\xde\x30\xc3\x30\xd4\x30\xf3\x30\xb0\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の接線マッピングモードが使用されていました\n" @*/ )) ; + return -1 ; } break ; case FbxGeometryElement::eIndexToDirect : - // インデックスの数が法線情報の数と異なっていたら無視 - if( Mesh->NormalNum != FbxTangentElem->GetIndexArray().GetCount() ) +// // インデックスモードの場合は間接参照代入 +// for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) +// { +// Index = FbxTangentElem->GetIndexArray().GetAt( j ) ; +// Mesh->Tangents[ j ].x = ( float ) FbxTangentElem->GetDirectArray().GetAt( Index )[ 0 ] ; +// Mesh->Tangents[ j ].y = ( float ) FbxTangentElem->GetDirectArray().GetAt( Index )[ 1 ] ; +// Mesh->Tangents[ j ].z = ( float )-FbxTangentElem->GetDirectArray().GetAt( Index )[ 2 ] ; +// } + + // インデックスモードの場合は接線テーブルを作成する + WorkTangents = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * TangentIndexNum, &RModel->Mem ) ; + if( WorkTangents == NULL ) { - continue ; + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5c\x4f\x6d\x69\x28\x75\x6e\x30\xa5\x63\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 作業用の接線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; + return -1 ; } - // 接線情報を格納するメモリ領域の確保 - Mesh->Tangents = ( VECTOR * )ADDMEMAREA( sizeof( VECTOR ) * Mesh->NormalNum, &RModel->Mem ) ; - if( Mesh->Tangents == NULL ) + // 接線テーブルの作成 + for( j = 0 ; j < TangentIndexNum ; j ++ ) { - DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\xa5\x63\xda\x7d\xc5\x60\x31\x58\x92\x30\x3c\x68\x0d\x7d\x59\x30\x8b\x30\xe1\x30\xe2\x30\xea\x30\x6e\x30\xba\x78\xdd\x4f\x6b\x30\x31\x59\x57\x65\x57\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 接線情報を格納するメモリの確保に失敗しました\n" @*/ )) ; - return -1 ; + Index = FbxTangentElem->GetIndexArray().GetAt( j ) ; + WorkTangents[ j ].x = ( float ) FbxTangentElem->GetDirectArray().GetAt( Index )[ 0 ] ; + WorkTangents[ j ].y = ( float ) FbxTangentElem->GetDirectArray().GetAt( Index )[ 1 ] ; + WorkTangents[ j ].z = ( float )-FbxTangentElem->GetDirectArray().GetAt( Index )[ 2 ] ; } - // インデックスモードの場合は間接参照代入 - for( j = 0 ; ( DWORD )j < Mesh->NormalNum ; j ++ ) + // 面の各頂点に対応する法線の情報を取得 + switch( FbxMappingMode ) { - Index = FbxTangentElem->GetIndexArray().GetAt( j ) ; - Mesh->Tangents[ j ].x = ( float ) FbxTangentElem->GetDirectArray().GetAt( Index )[ 0 ] ; - Mesh->Tangents[ j ].y = ( float ) FbxTangentElem->GetDirectArray().GetAt( Index )[ 1 ] ; - Mesh->Tangents[ j ].z = ( float )-FbxTangentElem->GetDirectArray().GetAt( Index )[ 2 ] ; + case FbxGeometryElement::eByControlPoint : + // 接線インデックスは頂点インデックスと等しくなる + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k++ ) + { + Index = MeshFace->VertexIndex[ l ] ; + if( Index < TangentIndexNum ) + { + Mesh->Tangents[ k ].x = ( float ) WorkTangents[ Index ].x ; + Mesh->Tangents[ k ].y = ( float ) WorkTangents[ Index ].y ; + Mesh->Tangents[ k ].z = ( float )-WorkTangents[ Index ].z ; + } + } + } + break ; + + case FbxGeometryElement::eByPolygonVertex : + // 接線インデックスは別個で存在する + MeshFace = Mesh->Faces ; + k = 0 ; + for( j = 0 ; ( DWORD )j < Mesh->FaceNum ; j ++, MeshFace ++ ) + { + for( l = 0 ; ( DWORD )l < MeshFace->IndexNum ; l ++, k ++ ) + { + if( k < TangentIndexNum ) + { + Mesh->Tangents[ k ].x = ( float ) WorkTangents[ k ].x ; + Mesh->Tangents[ k ].y = ( float ) WorkTangents[ k ].y ; + Mesh->Tangents[ k ].z = ( float )-WorkTangents[ k ].z ; + } + } + } + break ; + + default : + DXST_LOGFILEFMT_ADDUTF16LE(( "\x46\x00\x62\x00\x78\x00\x20\x00\x4c\x00\x6f\x00\x61\x00\x64\x00\x20\x00\x3a\x00\x20\x00\x5e\x97\xfe\x5b\xdc\x5f\x6e\x30\xa5\x63\xda\x7d\xde\x30\xc3\x30\xd4\x30\xf3\x30\xb0\x30\xe2\x30\xfc\x30\xc9\x30\x4c\x30\x7f\x4f\x28\x75\x55\x30\x8c\x30\x66\x30\x44\x30\x7e\x30\x57\x30\x5f\x30\x0a\x00\x00"/*@ L"Fbx Load : 非対応の接線マッピングモードが使用されていました\n" @*/ )) ; + return -1 ; } break ; diff --git a/DxModelLoader2.cpp b/DxModelLoader2.cpp index 6d9185b..522f6ae 100644 --- a/DxModelLoader2.cpp +++ b/DxModelLoader2.cpp @@ -2,7 +2,7 @@ // // DXライブラリ MQOモデルデータ読み込みプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelLoader3.cpp b/DxModelLoader3.cpp index 6b403c6..a276830 100644 --- a/DxModelLoader3.cpp +++ b/DxModelLoader3.cpp @@ -2,7 +2,7 @@ // // DXライブラリ PMDモデルデータ読み込みプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelLoader3.h b/DxModelLoader3.h index 9566d14..c505f63 100644 --- a/DxModelLoader3.h +++ b/DxModelLoader3.h @@ -2,7 +2,7 @@ // // DXライブラリ モデルデータ読み込み処理3用ヘッダ // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelLoader4.cpp b/DxModelLoader4.cpp index 3d169e8..8f47e36 100644 --- a/DxModelLoader4.cpp +++ b/DxModelLoader4.cpp @@ -2,7 +2,7 @@ // // DXライブラリ PMXモデルデータ読み込みプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelLoader4.h b/DxModelLoader4.h index 22f296b..40c6c2e 100644 --- a/DxModelLoader4.h +++ b/DxModelLoader4.h @@ -2,7 +2,7 @@ // // DXライブラリ モデルデータ読み込み処理4用ヘッダ // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelLoaderVMD.cpp b/DxModelLoaderVMD.cpp index 571e1b2..e27eeb0 100644 --- a/DxModelLoaderVMD.cpp +++ b/DxModelLoaderVMD.cpp @@ -2,7 +2,7 @@ // // DXライブラリ VMDデータ読み込みプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelLoaderVMD.h b/DxModelLoaderVMD.h index ff3fc7d..62b7812 100644 --- a/DxModelLoaderVMD.h +++ b/DxModelLoaderVMD.h @@ -2,7 +2,7 @@ // // DXライブラリ VMDファイルデータ構造体ヘッダ // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxModelRead.cpp b/DxModelRead.cpp index 2c3a8b4..6fbb11c 100644 --- a/DxModelRead.cpp +++ b/DxModelRead.cpp @@ -2,7 +2,7 @@ // // DXライブラリ モデルデータ読み込みプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -5376,7 +5376,7 @@ extern int MV1LoadModelToReadModel( // スキンメッシュの場合 for( i = 0 ; ( DWORD )i < Mesh->FaceNum ; i ++ ) { - WORD UseMatrix[ MV1_TRIANGLE_LIST_USE_BONE_MAX_NUM ] ; + WORD UseMatrix[ /* MV1_TRIANGLE_LIST_USE_BONE_MAX_NUM */ 1024 ] ; int UseBoneNum ; PolyNum = Mesh->Faces[ i ].PolygonNum ; diff --git a/DxModelRead.h b/DxModelRead.h index d4f2d1f..2c34c47 100644 --- a/DxModelRead.h +++ b/DxModelRead.h @@ -2,7 +2,7 @@ // // DXライブラリ モデルデータ読み込みヘッダ // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxMovie.cpp b/DxMovie.cpp index 18023e0..e593782 100644 --- a/DxMovie.cpp +++ b/DxMovie.cpp @@ -2,7 +2,7 @@ // // DXライブラリ ムービー再生処理用プログラム // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- diff --git a/DxMovie.h b/DxMovie.h index 9a7e627..f3fefc2 100644 --- a/DxMovie.h +++ b/DxMovie.h @@ -2,7 +2,7 @@ // // DXライブラリ 動画プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxNetwork.cpp b/DxNetwork.cpp index 382d326..9afb402 100644 --- a/DxNetwork.cpp +++ b/DxNetwork.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 通信関連プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxNetwork.h b/DxNetwork.h index 030779b..6f8cfd2 100644 --- a/DxNetwork.h +++ b/DxNetwork.h @@ -2,7 +2,7 @@ // // DXライブラリ 通信プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxRingBuffer.cpp b/DxRingBuffer.cpp index 1e4fd17..21eae25 100644 --- a/DxRingBuffer.cpp +++ b/DxRingBuffer.cpp @@ -2,7 +2,7 @@ // // DXライブラリ リングバッファプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxRingBuffer.h b/DxRingBuffer.h index c4f7d8b..15de09e 100644 --- a/DxRingBuffer.h +++ b/DxRingBuffer.h @@ -2,7 +2,7 @@ // // DXライブラリ リングバッファプログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxSoftImage.cpp b/DxSoftImage.cpp index 31c4d56..b513b21 100644 --- a/DxSoftImage.cpp +++ b/DxSoftImage.cpp @@ -2,7 +2,7 @@ // // DXライブラリ ソフトウェアで扱う画像プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxSoftImage.h b/DxSoftImage.h index 66f8819..323acdb 100644 --- a/DxSoftImage.h +++ b/DxSoftImage.h @@ -2,7 +2,7 @@ // // DXライブラリ ソフトウェアで扱う画像プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxSound.cpp b/DxSound.cpp index 8f666c2..8f38f13 100644 --- a/DxSound.cpp +++ b/DxSound.cpp @@ -2,7 +2,7 @@ // // DXライブラリ DirectSound制御プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -22,6 +22,15 @@ #include "DxASyncLoad.h" #include "DxLog.h" +// 外部関数プロトタイプ宣言 ------------------------------------------------------ + +#ifndef DX_NON_OGGVORBIS + +extern int GetOggCommentNumBase( STREAMDATA *Stream ) ; +extern int GetOggCommentBase( STREAMDATA *Stream, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) ; + +#endif // DX_NON_OGGVORBIS + #ifndef DX_NON_NAMESPACE namespace DxLib @@ -6259,10 +6268,7 @@ extern int NS_SetSoundCurrentPosition( LONGLONG Byte, int SoundHandle ) // 再生位置を変更する // sd->Buffer[ i ]->SetCurrentPosition( Byte ) ; // SoundBuffer_SetCurrentPosition( &sd->Buffer[ i ], Byte ) ; - SoundBuffer_SetCurrentPosition( &sd->Buffer[ sd->Normal.BackPlayBufferNo ], ( DWORD )Byte ) ; - - // 終了 - return 0 ; + return SoundBuffer_SetCurrentPosition( &sd->Buffer[ sd->Normal.BackPlayBufferNo ], ( DWORD )Byte ) ; } // サウンドハンドルの再生位置をバイト単位で取得する @@ -6322,10 +6328,7 @@ extern int NS_SetSoundCurrentTime( LONGLONG Time, int SoundHandle ) // sd->Buffer[ i ]->SetCurrentPosition( time ) ; // SoundBuffer_SetCurrentPosition( &sd->Buffer[ i ], time ) ; - SoundBuffer_SetCurrentPosition( &sd->Buffer[ sd->Normal.BackPlayBufferNo ], ( DWORD )time ) ; - - // 終了 - return 0 ; + return SoundBuffer_SetCurrentPosition( &sd->Buffer[ sd->Normal.BackPlayBufferNo ], ( DWORD )time ) ; } // GetSoundTotalSample のグローバル変数にアクセスしないバージョン @@ -7954,6 +7957,139 @@ ERR : return -1 ; } +#ifndef DX_NON_OGGVORBIS + +// Oggファイルのコメント情報の数を取得する +extern int GetOggCommentNum_WCHAR_T( const wchar_t *FileName ) +{ + DWORD_PTR fp = 0 ; + STREAMDATA Stream ; + int Comments ; + + // ファイルを開く + fp = DX_FOPEN( FileName ) ; + if( fp == 0 ) + { + DXST_LOGFILE_ADDA( "GetOggCommentNum Sound File Open Error\n" ) ; + return -1 ; + } + + // ストリームデータ情報をセットする + Stream.DataPoint = fp ; + Stream.ReadShred = *GetFileStreamDataShredStruct() ; + + // libogg を使用する処理を実行 + Comments = GetOggCommentNumBase( &Stream ) ; + + // ファイルを閉じる + DX_FCLOSE( fp ) ; + + // コメントの数を返す + return Comments ; +} + +extern int NS_GetOggCommentNum( const TCHAR *FileName ) +{ +#ifdef UNICODE + return GetOggCommentNum_WCHAR_T( FileName ) ; +#else + int Result ; + + TCHAR_TO_WCHAR_T_STRING_ONE_BEGIN( FileName, return -1 ) + + Result = GetOggCommentNum_WCHAR_T( UseFileNameBuffer ) ; + + TCHAR_TO_WCHAR_T_STRING_END( FileName ) + + return Result ; +#endif +} + +extern int NS_GetOggCommentNumWithStrLen( const TCHAR *FileName, size_t FileNameLength ) +{ + int Result ; +#ifdef UNICODE + WCHAR_T_STRING_WITH_STRLEN_TO_WCHAR_T_STRING_ONE_BEGIN( FileName, FileNameLength, return -1 ) + + Result = GetOggCommentNum_WCHAR_T( UseFileNameBuffer ) ; + + WCHAR_T_STRING_WITH_STRLEN_TO_WCHAR_T_STRING_END( FileName ) +#else + TCHAR_STRING_WITH_STRLEN_TO_WCHAR_T_STRING_ONE_BEGIN( FileName, FileNameLength, return -1 ) + + Result = GetOggCommentNum_WCHAR_T( UseFileNameBuffer ) ; + + TCHAR_STRING_WITH_STRLEN_TO_WCHAR_T_STRING_END( FileName ) +#endif + return Result ; +} + +// Oggファイルのコメント情報を取得する +extern int GetOggComment_WCHAR_T( const wchar_t *FileName, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) +{ + DWORD_PTR fp = 0 ; + STREAMDATA Stream ; + int Result ; + + // ファイルを開く + fp = DX_FOPEN( FileName ) ; + if( fp == 0 ) + { + DXST_LOGFILE_ADDA( "GetOggComment Sound File Open Error\n" ) ; + return -1 ; + } + + // ストリームデータ情報をセットする + Stream.DataPoint = fp ; + Stream.ReadShred = *GetFileStreamDataShredStruct() ; + + // libogg を使用する処理を実行 + Result = GetOggCommentBase( &Stream, CommentIndex, CommentNameBuffer, CommentNameBufferBytes, CommentBuffer, CommentBufferBytes ) ; + + // ファイルを閉じる + DX_FCLOSE( fp ) ; + + // 正常終了 + return 0 ; +} + +extern int NS_GetOggComment( const TCHAR *FileName, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) +{ +#ifdef UNICODE + return GetOggComment_WCHAR_T( FileName, CommentIndex, CommentNameBuffer, CommentNameBufferBytes, CommentBuffer, CommentBufferBytes ) ; +#else + int Result ; + + TCHAR_TO_WCHAR_T_STRING_ONE_BEGIN( FileName, return -1 ) + + Result = GetOggComment_WCHAR_T( UseFileNameBuffer, CommentIndex, CommentNameBuffer, CommentNameBufferBytes, CommentBuffer, CommentBufferBytes ) ; + + TCHAR_TO_WCHAR_T_STRING_END( FileName ) + + return Result ; +#endif +} + +extern int NS_GetOggCommentWithStrLen( const TCHAR *FileName, size_t FileNameLength, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) +{ + int Result ; +#ifdef UNICODE + WCHAR_T_STRING_WITH_STRLEN_TO_WCHAR_T_STRING_ONE_BEGIN( FileName, FileNameLength, return -1 ) + + Result = GetOggComment_WCHAR_T( UseFileNameBuffer, CommentIndex, CommentNameBuffer, CommentNameBufferBytes, CommentBuffer, CommentBufferBytes ) ; + + WCHAR_T_STRING_WITH_STRLEN_TO_WCHAR_T_STRING_END( FileName ) +#else + TCHAR_STRING_WITH_STRLEN_TO_WCHAR_T_STRING_ONE_BEGIN( FileName, FileNameLength, return -1 ) + + Result = GetOggComment_WCHAR_T( UseFileNameBuffer, CommentIndex, CommentNameBuffer, CommentNameBufferBytes, CommentBuffer, CommentBufferBytes ) ; + + TCHAR_STRING_WITH_STRLEN_TO_WCHAR_T_STRING_END( FileName ) +#endif + return Result ; +} + +#endif // DX_NON_OGGVORBIS @@ -9475,6 +9611,12 @@ extern int SoundBuffer_SetCurrentPosition( SOUNDBUFFER *Buffer, DWORD NewPos ) { if( Buffer->Valid == FALSE ) return -1 ; + // 新しい位置が範囲から外れていたらエラー + if( NewPos / Buffer->Format.nBlockAlign >= ( DWORD )Buffer->SampleNum ) + { + return -1 ; + } + if( SoundSysData.EnableSoundCaptureFlag || SoundSysData.EnableSelfMixingFlag ) { // クリティカルセクションの取得 @@ -13019,6 +13161,7 @@ extern int NS_ReadSoftSoundData( int SoftSoundHandle, LONGLONG SamplePosition, i { SOFTSOUND * SSound ; BYTE *Src ; + DWORD Sample ; // エラー判定 if( SSND_MASKHCHK( SoftSoundHandle, SSound ) ) return -1 ; @@ -13097,6 +13240,60 @@ extern int NS_ReadSoftSoundData( int SoftSoundHandle, LONGLONG SamplePosition, i } } break ; + + case 24 : + if( Channel1 ) + { + Sample = Src[ 0 ] | ( Src[ 1 ] << 8 ) | ( Src[ 2 ] << 16 ) ; + if( ( Sample & 0x800000 ) != 0 ) + { + *Channel1 = ( int )( Sample | 0xff000000 ) ; + } + else + { + *Channel1 = ( int )Sample ; + } + } + + if( Channel2 ) + { + if( SSound->BufferFormat.nChannels == 1 ) + { + *Channel2 = 0 ; + } + else + { + Sample = Src[ 3 ] | ( Src[ 4 ] << 8 ) | ( Src[ 5 ] << 16 ) ; + if( ( Sample & 0x800000 ) != 0 ) + { + *Channel2 = ( int )( Sample | 0xff000000 ) ; + } + else + { + *Channel2 = ( int )Sample ; + } + } + } + break ; + + case 32 : + if( Channel1 ) + { + *Channel1 = ( ( int * )Src )[ 0 ] ; + } + + if( Channel2 ) + { + if( SSound->BufferFormat.nChannels == 1 ) + { + *Channel2 = 0 ; + } + else + { + *Channel2 = ( ( int * )Src )[ 1 ] ; + } + } + break ; } } @@ -13109,6 +13306,7 @@ extern int NS_ReadSoftSoundDataF( int SoftSoundHandle, LONGLONG SamplePosition, { SOFTSOUND * SSound ; BYTE *Src ; + DWORD Sample ; // エラー判定 if( SSND_MASKHCHK( SoftSoundHandle, SSound ) ) return -1 ; @@ -13187,6 +13385,60 @@ extern int NS_ReadSoftSoundDataF( int SoftSoundHandle, LONGLONG SamplePosition, } } break ; + + case 24 : + if( Channel1 ) + { + Sample = Src[ 0 ] | ( Src[ 1 ] << 8 ) | ( Src[ 2 ] << 16 ) ; + if( ( Sample & 0x800000 ) != 0 ) + { + *Channel1 = ( int )( Sample | 0xff000000 ) / 8388608.0f ; + } + else + { + *Channel1 = ( int )Sample / 8388608.0f ; + } + } + + if( Channel2 ) + { + if( SSound->BufferFormat.nChannels == 1 ) + { + *Channel2 = 0.0f ; + } + else + { + Sample = Src[ 3 ] | ( Src[ 4 ] << 8 ) | ( Src[ 5 ] << 16 ) ; + if( ( Sample & 0x800000 ) != 0 ) + { + *Channel2 = ( int )( Sample | 0xff000000 ) / 8388608.0f ; + } + else + { + *Channel2 = ( int )Sample / 8388608.0f ; + } + } + } + break ; + + case 32 : + if( Channel1 ) + { + *Channel1 = ( ( int * )Src )[ 0 ] / 4294967296.0f ; + } + + if( Channel2 ) + { + if( SSound->BufferFormat.nChannels == 1 ) + { + *Channel2 = 0.0f ; + } + else + { + *Channel2 = ( ( int * )Src )[ 1 ] / 4294967296.0f ; + } + } + break ; } } @@ -13199,6 +13451,7 @@ extern int NS_WriteSoftSoundData( int SoftSoundHandle, LONGLONG SamplePosition, { SOFTSOUND * SSound ; BYTE *Dest ; + DWORD Sample ; // エラー判定 if( SSND_MASKHCHK( SoftSoundHandle, SSound ) ) return -1 ; @@ -13255,6 +13508,34 @@ extern int NS_WriteSoftSoundData( int SoftSoundHandle, LONGLONG SamplePosition, ( ( short * )Dest )[ 1 ] = ( short )Channel2 ; } break ; + + case 24 : + if( Channel1 > 8388607 ) Channel1 = 8388607 ; + else if( Channel1 < -8388608 ) Channel1 = -8388608 ; + Sample = ( DWORD )Channel1 ; + Dest[ 0 ] = ( BYTE )Sample ; + Dest[ 1 ] = ( BYTE )( Sample >> 8 ); + Dest[ 2 ] = ( BYTE )( Sample >> 16 ) ; + + if( SSound->BufferFormat.nChannels != 1 ) + { + if( Channel2 > 8388607 ) Channel2 = 8388607 ; + else if( Channel2 < -8388608 ) Channel2 = -8388608 ; + Sample = ( DWORD )Channel2 ; + Dest[ 3 ] = ( BYTE )Sample ; + Dest[ 4 ] = ( BYTE )( Sample >> 8 ); + Dest[ 5 ] = ( BYTE )( Sample >> 16 ) ; + } + break ; + + case 32 : + ( ( int * )Dest )[ 0 ] = Channel1 ; + + if( SSound->BufferFormat.nChannels != 1 ) + { + ( ( int * )Dest )[ 1 ] = Channel2 ; + } + break ; } } @@ -13268,6 +13549,7 @@ extern int NS_WriteSoftSoundDataF( int SoftSoundHandle, LONGLONG SamplePosition, SOFTSOUND * SSound ; BYTE *Dest ; int ChannelI ; + DWORD Sample ; // エラー判定 if( SSND_MASKHCHK( SoftSoundHandle, SSound ) ) return -1 ; @@ -13328,6 +13610,36 @@ extern int NS_WriteSoftSoundDataF( int SoftSoundHandle, LONGLONG SamplePosition, ( ( short * )Dest )[ 1 ] = ( short )ChannelI ; } break ; + + case 24 : + ChannelI = _FTOL( Channel1 * 8388608.0f ) ; + if( ChannelI > 8388607 ) ChannelI = 8388607 ; + else if( ChannelI < -8388608 ) ChannelI = -8388608 ; + Sample = ( DWORD )ChannelI ; + Dest[ 0 ] = ( BYTE )Sample ; + Dest[ 1 ] = ( BYTE )( Sample >> 8 ); + Dest[ 2 ] = ( BYTE )( Sample >> 16 ) ; + + if( SSound->BufferFormat.nChannels != 1 ) + { + ChannelI = _FTOL( Channel2 * 8388608.0f ) ; + if( ChannelI > 8388607 ) ChannelI = 8388607 ; + else if( ChannelI < -8388608 ) ChannelI = -8388608 ; + Sample = ( DWORD )ChannelI ; + Dest[ 3 ] = ( BYTE )Sample ; + Dest[ 4 ] = ( BYTE )( Sample >> 8 ); + Dest[ 5 ] = ( BYTE )( Sample >> 16 ) ; + } + break ; + + case 32 : + ( ( int * )Dest )[ 0 ] = _FTOL( Channel1 * 4294967296.0f ) ; + + if( SSound->BufferFormat.nChannels != 1 ) + { + ( ( int * )Dest )[ 1 ] = _FTOL( Channel2 * 4294967296.0f ) ; + } + break ; } } @@ -19360,6 +19672,8 @@ extern int NS_LoadSoundMemFromSoftSound( int SoftSoundHandle, int BufferNum ) GParam.CreateSoundDataType = DX_SOUNDDATATYPE_MEMNOPRESS ; NewHandle = LoadSoundMemByMemImageBase_UseGParam( &GParam, TRUE, -1, WaveImage, WaveSize, BufferNum, -1, FALSE, FALSE ) ; + _MEMSET( WaveImage, 0, WaveSize ) ; + // メモリの解放 DXFREE( WaveImage ) ; WaveImage = NULL ; diff --git a/DxSound.h b/DxSound.h index 390338a..9a280b9 100644 --- a/DxSound.h +++ b/DxSound.h @@ -2,7 +2,7 @@ // // DXライブラリ サウンドプログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -166,7 +166,7 @@ struct SOUNDBUFFER volatile int EnableTopPos ; // TopPos_WriteSamples が有効かどうか volatile ULONGLONG TopPos_TotalWriteSamples ; // バッファの先頭が再生開始される時の総再生サンプル数 volatile int AddPlaySoundBufferList ; // PlaySoundBufferList がリストに追加されているかどうか( TRUE:追加されている FALSE:追加されていない ) - SIMPLELIST PlaySoundBufferList ; // 再生中サウンドバッファリスト処理用構造体 + volatile SIMPLELIST PlaySoundBufferList ; // 再生中サウンドバッファリスト処理用構造体 volatile int OutputDelaySamples ; // 出力を遅らせるサンプル数 // 3Dサウンド再生用データ diff --git a/DxSoundConvert.cpp b/DxSoundConvert.cpp index 710bbb9..80ee188 100644 --- a/DxSoundConvert.cpp +++ b/DxSoundConvert.cpp @@ -2,7 +2,7 @@ // // DXライブラリ サウンドデータ変換プログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -560,7 +560,7 @@ static int SetupSoundConvert_WAVE( SOUNDCONV *SoundConv ) Wave->SrcSampleNum = SoundConv->OutFormat.nSamplesPerSec ; Wave->SrcBufferSize = format->nAvgBytesPerSec ; - Wave->SrcBuffer = ( BYTE * )DXALLOC( Wave->SrcBufferSize ) ; + Wave->SrcBuffer = ( BYTE * )DXALLOC( ( size_t )Wave->SrcBufferSize ) ; if( Wave->SrcBuffer == NULL ) goto ERR ; break ; diff --git a/DxSoundConvert.h b/DxSoundConvert.h index b777c87..3d30646 100644 --- a/DxSoundConvert.h +++ b/DxSoundConvert.h @@ -2,7 +2,7 @@ // // DXライブラリ サウンドデータ変換プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxStatic.h b/DxStatic.h index d094181..209168d 100644 --- a/DxStatic.h +++ b/DxStatic.h @@ -2,7 +2,7 @@ // // DXライブラリ 内部使用関連用ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ---------------------------------------------------------------------------- @@ -483,6 +483,7 @@ namespace DxLib extern int NS_GetWindowEdgeWidth( int *LeftWidth, int *RightWidth, int *TopWidth, int *BottomWidth ) ; // ウインドウの上下左右の縁の幅を取得する extern int NS_GetWindowPosition( int *x, int *y ) ; // ウインドウモードのウインドウの位置を取得する( 枠も含めた左上座標 ) extern int NS_GetWindowUserCloseFlag( int StateResetFlag = FALSE ) ; // ウインドウの閉じるボタンが押されたかどうかを取得する +extern int NS_CheckWindowMaximizeButtonInput( int StateResetFlag = TRUE ) ; // メインウインドウの最大化ボタンが押されたかどうかを取得する、SetWindowMaximizeButtonBehavior( 1 ); が実行されている場合のみ有効な関数( StateResetFlag TRUE = 押された状態をリセットする FALSE = 押された状態をリセットしない ) extern int NS_GetNotDrawFlag( void ) ; // 描画機能を使うかどうかのフラグを取得する extern int NS_GetPaintMessageFlag( void ) ; // WM_PAINT メッセージが来たかどうかを取得する(戻り値 TRUE:WM_PAINTメッセージが来た(一度取得すると以後、再び WM_PAINTメッセージが来るまで FALSE が返ってくるようになる) FALSE:WM_PAINT メッセージは来ていない) extern int NS_GetValidHiPerformanceCounter( void ) ; // パフォーマンスカウンタが有効かどうかを取得する(戻り値 TRUE:有効 FALSE:無効) @@ -516,6 +517,7 @@ namespace DxLib extern int NS_SetWindowPosition( int x, int y ) ; // ウインドウモードのウインドウの位置を設定する( 枠も含めた左上座標 ) extern int NS_SetSysCommandOffFlag( int Flag , const TCHAR *HookDllPath = NULL ) ; // タスクスイッチを有効にするかどうかを設定する extern int NS_SetSysCommandOffFlagWithStrLen( int Flag , const TCHAR *HookDllPath = NULL , size_t HookDllPathLength = 0 ) ; // タスクスイッチを有効にするかどうかを設定する +extern int NS_SetWindowMaximizeButtonBehavior( int BehaviorType ) ; // メインウインドウの最大化ボタンが押されたときの挙動を設定する( BehaviorType 0=標準動作 1=標準動作は行わず、最大化ボタンが押されたかどうかは CheckWindowMaximizeButtonInput で判定する ) extern int NS_SetHookWinProc( WNDPROC WinProc ) ; // メッセージをフックするウインドウプロージャを登録する extern int NS_SetUseHookWinProcReturnValue( int UseFlag ) ; // SetHookWinProc で設定したウインドウプロージャの戻り値を使用するかどうかを設定する、SetHookWinProc で設定したウインドウプロージャの中でのみ使用可能( UseFlag TRUE:戻り値を使用して、DXライブラリのウインドウプロージャの処理は行わない FALSE:戻り値は使用せず、ウインドウプロージャから出た後、DXライブラリのウインドウプロージャの処理を行う ) extern int NS_SetDoubleStartValidFlag( int Flag ) ; // 2重起動を許すかどうかのフラグをセットする @@ -1605,6 +1607,7 @@ extern int NS_DrawRectRotaGraph3F( float x, float y, int SrcX, int SrcY, extern int NS_SetUseDirect3DVersion( int Version /* DX_DIRECT3D_9 など */ ) ; // 使用する Direct3D のバージョンを設定する、DxLib_Init 呼び出しの前でのみ使用可能  extern int NS_GetUseDirect3DVersion( void ) ; // 使用している Direct3D のバージョンを取得する( DX_DIRECT3D_9 など ) extern int NS_GetUseDirect3D11FeatureLevel( void ) ; // 使用している Direct3D11 の FeatureLevel ( DX_DIRECT3D_11_FEATURE_LEVEL_9_1 等 )を取得する( 戻り値 -1:エラー -1以外:Feature Level ) +extern int NS_SetUseDirect3D11AdapterIndex( int Index ) ; // 使用するグラフィックスデバイスのアダプターのインデックスを設定する extern int NS_SetUseDirectDrawFlag( int Flag ) ; // ( 同効果のSetUseSoftwareRenderModeFlag を使用して下さい )DirectDrawを使用するかどうかをセットする extern int NS_SetUseGDIFlag( int Flag ) ; // GDI描画を必要とするか、を変更する extern int NS_GetUseGDIFlag( void ) ; // GDI描画を必要とするかの状態を取得する @@ -1772,6 +1775,7 @@ extern int NS_DrawRectRotaGraph3F( float x, float y, int SrcX, int SrcY, // フィルター関係関数 #ifndef DX_NON_FILTER +extern int NS_SetGraphFilterBltBlendMode( int BlendMode /* DX_BLENDMODE_ALPHA など */ ) ; // GraphFilterBlt や GraphBlendBlt の結果を転送先に転送する際のブレンドモードを設定する( 現状で対応しているのは DX_BLENDMODE_NOBLEND と DX_BLENDMODE_ALPHA のみ ) extern int NS_GraphFilter( int GrHandle, int FilterType /* DX_GRAPH_FILTER_GAUSS 等 */ , ... ) ; // 画像にフィルター処理を行う extern int NS_GraphFilterBlt( int SrcGrHandle, int DestGrHandle, int FilterType /* DX_GRAPH_FILTER_GAUSS 等 */ , ... ) ; // 画像のフィルター付き転送を行う extern int NS_GraphFilterRectBlt( int SrcGrHandle, int DestGrHandle, int SrcX1, int SrcY1, int SrcX2, int SrcY2, int DestX, int DestY, int FilterType /* DX_GRAPH_FILTER_GAUSS 等 */ , ... ) ; // 画像のフィルター付き転送を行う( 矩形指定 ) @@ -2754,6 +2758,12 @@ extern int NS_CreateColorData( COLORDATA *ColorDataBuf, int ColorBitDe // 特殊関数 extern int NS_GetMP3TagInfo( const TCHAR *FileName, TCHAR *TitleBuffer, size_t TitleBufferBytes, TCHAR *ArtistBuffer, size_t ArtistBufferBytes, TCHAR *AlbumBuffer, size_t AlbumBufferBytes, TCHAR *YearBuffer, size_t YearBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes, TCHAR *TrackBuffer, size_t TrackBufferBytes, TCHAR *GenreBuffer, size_t GenreBufferBytes, int *PictureGrHandle ) ; // MP3ファイルのタグ情報を取得する extern int NS_GetMP3TagInfoWithStrLen( const TCHAR *FileName, size_t FileNameLength, TCHAR *TitleBuffer, size_t TitleBufferBytes, TCHAR *ArtistBuffer, size_t ArtistBufferBytes, TCHAR *AlbumBuffer, size_t AlbumBufferBytes, TCHAR *YearBuffer, size_t YearBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes, TCHAR *TrackBuffer, size_t TrackBufferBytes, TCHAR *GenreBuffer, size_t GenreBufferBytes, int *PictureGrHandle ) ; // MP3ファイルのタグ情報を取得する +#ifndef DX_NON_OGGVORBIS +extern int NS_GetOggCommentNum( const TCHAR *FileName ) ; // Oggファイルのコメント情報の数を取得する +extern int NS_GetOggCommentNumWithStrLen( const TCHAR *FileName, size_t FileNameLength ) ; // Oggファイルのコメント情報の数を取得する +extern int NS_GetOggComment( const TCHAR *FileName, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) ; // Oggファイルのコメント情報を取得する +extern int NS_GetOggCommentWithStrLen( const TCHAR *FileName, size_t FileNameLength, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) ; // Oggファイルのコメント情報を取得する +#endif // DX_NON_OGGVORBIS // 設定関係関数 @@ -3233,6 +3243,7 @@ extern int NS_CreateColorData( COLORDATA *ColorDataBuf, int ColorBitDe #define NS_GetWindowEdgeWidth GetWindowEdgeWidth #define NS_GetWindowPosition GetWindowPosition #define NS_GetWindowUserCloseFlag GetWindowUserCloseFlag +#define NS_CheckWindowMaximizeButtonInput CheckWindowMaximizeButtonInput #define NS_GetNotDrawFlag GetNotDrawFlag #define NS_GetPaintMessageFlag GetPaintMessageFlag #define NS_GetValidHiPerformanceCounter GetValidHiPerformanceCounter @@ -3266,6 +3277,7 @@ extern int NS_CreateColorData( COLORDATA *ColorDataBuf, int ColorBitDe #define NS_SetWindowPosition SetWindowPosition #define NS_SetSysCommandOffFlag SetSysCommandOffFlag #define NS_SetSysCommandOffFlagWithStrLen SetSysCommandOffFlagWithStrLen +#define NS_SetWindowMaximizeButtonBehavior SetWindowMaximizeButtonBehavior #define NS_SetHookWinProc SetHookWinProc #define NS_SetUseHookWinProcReturnValue SetUseHookWinProcReturnValue #define NS_SetDoubleStartValidFlag SetDoubleStartValidFlag @@ -4318,6 +4330,7 @@ extern int NS_CreateColorData( COLORDATA *ColorDataBuf, int ColorBitDe #define NS_SetUseDirect3DVersion SetUseDirect3DVersion #define NS_GetUseDirect3DVersion GetUseDirect3DVersion #define NS_GetUseDirect3D11FeatureLevel GetUseDirect3D11FeatureLevel +#define NS_SetUseDirect3D11AdapterIndex SetUseDirect3D11AdapterIndex #define NS_SetUseDirectDrawFlag SetUseDirectDrawFlag #define NS_SetUseGDIFlag SetUseGDIFlag #define NS_GetUseGDIFlag GetUseGDIFlag @@ -4484,6 +4497,7 @@ extern int NS_CreateColorData( COLORDATA *ColorDataBuf, int ColorBitDe // フィルター関係関数 #ifndef DX_NON_FILTER +#define NS_SetGraphFilterBltBlendMode SetGraphFilterBltBlendMode #define NS_GraphFilter GraphFilter #define NS_GraphFilterBlt GraphFilterBlt #define NS_GraphFilterRectBlt GraphFilterRectBlt @@ -5427,6 +5441,12 @@ extern int NS_CreateColorData( COLORDATA *ColorDataBuf, int ColorBitDe // 特殊関数 #define NS_GetMP3TagInfo GetMP3TagInfo #define NS_GetMP3TagInfoWithStrLen GetMP3TagInfoWithStrLen +#ifndef DX_NON_OGGVORBIS +#define NS_GetOggCommentNum GetOggCommentNum +#define NS_GetOggCommentNumWithStrLen GetOggCommentNumWithStrLen +#define NS_GetOggComment GetOggComment +#define NS_GetOggCommentWithStrLen GetOggCommentWithStrLen +#endif // DX_NON_OGGVORBIS // 設定関係関数 diff --git a/DxSystem.cpp b/DxSystem.cpp index 3a0fc5d..9c5874f 100644 --- a/DxSystem.cpp +++ b/DxSystem.cpp @@ -2,7 +2,7 @@ // // DXライブラリ システムプログラム // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxSystem.h b/DxSystem.h index 2084418..7f4d6db 100644 --- a/DxSystem.h +++ b/DxSystem.h @@ -2,7 +2,7 @@ // // DXライブラリ システムプログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxThread.cpp b/DxThread.cpp index 0ecef82..df0846e 100644 --- a/DxThread.cpp +++ b/DxThread.cpp @@ -2,7 +2,7 @@ // // DXライブラリ スレッド関係プログラム // -// Ver 3.21f +// Ver 3.22a // //----------------------------------------------------------------------------- diff --git a/DxThread.h b/DxThread.h index 00d25bf..143abac 100644 --- a/DxThread.h +++ b/DxThread.h @@ -2,7 +2,7 @@ // // DXライブラリ スレッド関係プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxUseCLib.cpp b/DxUseCLib.cpp index 70bc3c7..82e1c66 100644 --- a/DxUseCLib.cpp +++ b/DxUseCLib.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 標準Cライブラリ使用コード // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxUseCLib.h b/DxUseCLib.h index d42ae9e..1703fc4 100644 --- a/DxUseCLib.h +++ b/DxUseCLib.h @@ -2,7 +2,7 @@ // // DXライブラリ 標準Cライブラリ使用プログラムヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxUseCLibLive2DCubism4.cpp b/DxUseCLibLive2DCubism4.cpp index 58af402..6907f83 100644 --- a/DxUseCLibLive2DCubism4.cpp +++ b/DxUseCLibLive2DCubism4.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 標準Cライブラリ使用コード Live2D Cubism4 関係 // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxUseCLibLive2DCubism4.h b/DxUseCLibLive2DCubism4.h index 9013adc..565c3ab 100644 --- a/DxUseCLibLive2DCubism4.h +++ b/DxUseCLibLive2DCubism4.h @@ -2,7 +2,7 @@ // // DXライブラリ 標準Cライブラリ使用コード Live2D Cubism4 関係ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- diff --git a/DxUseCLibOgg.cpp b/DxUseCLibOgg.cpp index 8decd65..6d54b7b 100644 --- a/DxUseCLibOgg.cpp +++ b/DxUseCLibOgg.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 標準Cライブラリ使用コード Ogg関係 // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -3061,7 +3061,132 @@ extern int GetSoundConvertLoopAreaInfo_OGG( SOUNDCONV *SoundConv, LONGLONG *Loo return 0 ; } -#endif +extern int GetOggCommentNumBase( STREAMDATA *Stream ) +{ + DWORD_PTR fp = 0 ; + int Comments ; + OggVorbis_File File ; + ov_callbacks ogfunc ; + vorbis_comment *comment ; + + // コールバック関数を用意する + ogfunc.read_func = ( size_t ( * )( void *, size_t, size_t, void * ) )Ogg_StreamRead ; + ogfunc.seek_func = ( int ( * )( void *, ogg_int64_t, int ) )Ogg_StreamSeek64_wrap ; + ogfunc.close_func = ( int ( * )( void * ) )Ogg_StreamClose ; + ogfunc.tell_func = ( long ( * )( void * ) )Ogg_StreamTell ; + + // Oggファイルのセットアップ + if( ov_open_callbacks( Stream, &File, NULL, 0, ogfunc ) != 0 ) + { + DXST_LOGFILE_ADDA( "GetOggCommentNum Ogg File Setup Error\n" ) ; + return -1 ; + } + + // コメントの数を取得 + comment = ov_comment( &File, -1 ) ; + Comments = comment->comments ; + + // ファイルを閉じる + ov_clear( &File ) ; + + // コメントの数を返す + return Comments ; +} + +extern int GetOggCommentBase( STREAMDATA *Stream, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) +{ + OggVorbis_File File ; + ov_callbacks ogfunc ; + vorbis_comment *comment ; + int SrcBytes, DestBytes ; + DWORD UTF8CharCode ; + DWORD TCHARCharCode ; + int CharBytes ; + + // コールバック関数を用意する + ogfunc.read_func = ( size_t ( * )( void *, size_t, size_t, void * ) )Ogg_StreamRead ; + ogfunc.seek_func = ( int ( * )( void *, ogg_int64_t, int ) )Ogg_StreamSeek64_wrap ; + ogfunc.close_func = ( int ( * )( void * ) )Ogg_StreamClose ; + ogfunc.tell_func = ( long ( * )( void * ) )Ogg_StreamTell ; + + // Oggファイルのセットアップ + if( ov_open_callbacks( Stream, &File, NULL, 0, ogfunc ) != 0 ) + { + DXST_LOGFILE_ADDA( "GetOggComment Ogg File Setup Error\n" ) ; + return -1 ; + } + + // コメントの情報を取得 + comment = ov_comment( &File, -1 ) ; + + // コメントインデックスチェック + if( CommentIndex < 0 || CommentIndex >= comment->comments ) + { + ov_clear( &File ) ; + return -1 ; + } + + // コメント名をコピー + SrcBytes = 0 ; + DestBytes = 0 ; + for(;;) + { + if( SrcBytes >= comment->comment_lengths[ CommentIndex ] || comment->user_comments[ CommentIndex ][ SrcBytes ] == 0 ) + { + DXST_LOGFILE_ADDA( "GetOggComment Comment Format Error\n" ) ; + ov_clear( &File ) ; + return -1 ; + } + + UTF8CharCode = GetCharCode( &comment->user_comments[ CommentIndex ][ SrcBytes ], DX_CHARCODEFORMAT_UTF8, &CharBytes ) ; + SrcBytes += CharBytes ; + if( UTF8CharCode == 0x3d /* '=' */ ) + { + break ; + } + + if( DestBytes < ( int )CommentNameBufferBytes ) + { + TCHARCharCode = ConvCharCode( UTF8CharCode, DX_CHARCODEFORMAT_UTF8, _TCHARCODEFORMAT ) ; + DestBytes += PutCharCode( TCHARCharCode, _TCHARCODEFORMAT, ( char * )&CommentNameBuffer[ DestBytes ], ( size_t )CommentNameBufferBytes - DestBytes ) ; + } + } + if( DestBytes < ( int )CommentNameBufferBytes ) + { + DestBytes += PutCharCode( 0, _TCHARCODEFORMAT, ( char * )&CommentNameBuffer[ DestBytes ], ( size_t )CommentNameBufferBytes - DestBytes ) ; + } + + // コメント文字列をコピー + DestBytes = 0 ; + for(;;) + { + if( SrcBytes >= comment->comment_lengths[ CommentIndex ] || comment->user_comments[ CommentIndex ][ SrcBytes ] == 0 ) + { + break ; + } + + UTF8CharCode = GetCharCode( &comment->user_comments[ CommentIndex ][ SrcBytes ], DX_CHARCODEFORMAT_UTF8, &CharBytes ) ; + SrcBytes += CharBytes ; + + if( DestBytes < ( int )CommentNameBufferBytes ) + { + TCHARCharCode = ConvCharCode( UTF8CharCode, DX_CHARCODEFORMAT_UTF8, _TCHARCODEFORMAT ) ; + DestBytes += PutCharCode( TCHARCharCode, _TCHARCODEFORMAT, ( char * )&CommentBuffer[ DestBytes ], ( size_t )CommentBufferBytes - DestBytes ) ; + } + } + if( DestBytes < ( int )CommentBufferBytes ) + { + DestBytes += PutCharCode( 0, _TCHARCODEFORMAT, ( char * )&CommentBuffer[ DestBytes ], ( size_t )CommentBufferBytes - DestBytes ) ; + } + + // ファイルを閉じる + ov_clear( &File ) ; + + // 正常終了 + return 0 ; +} + +#endif // DX_NON_OGGVORBIS diff --git a/DxUseCLibOgg.h b/DxUseCLibOgg.h index 2496797..84125c8 100644 --- a/DxUseCLibOgg.h +++ b/DxUseCLibOgg.h @@ -2,7 +2,7 @@ // // DXライブラリ 標準Cライブラリ使用コード Ogg関係ヘッダファイル // -// Ver 3.21f +// Ver 3.22a // // ------------------------------------------------------------------------------- @@ -188,6 +188,13 @@ extern void TheoraDecode_ReleaseSurface_PF( DECODE_THEORA *DT ) ; #endif +#ifndef DX_NON_OGGVORBIS + +extern int GetOggCommentNumBase( STREAMDATA *Stream ) ; +extern int GetOggCommentBase( STREAMDATA *Stream, int CommentIndex, TCHAR *CommentNameBuffer, size_t CommentNameBufferBytes, TCHAR *CommentBuffer, size_t CommentBufferBytes ) ; + +#endif + //} #endif // DX_USECLIBOGG_H diff --git a/DxUseCLibPhysics.cpp b/DxUseCLibPhysics.cpp index a90f19d..00a30fe 100644 --- a/DxUseCLibPhysics.cpp +++ b/DxUseCLibPhysics.cpp @@ -2,7 +2,7 @@ // // DXライブラリ 物理演算処理 // -// Ver 3.21f +// Ver 3.22a // // -------------------------------------------------------------------------------