Table of Contents

include/AK/Plugin/AkReflectGameData.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
00003 released in source code form as part of the SDK installer package.
00004 
00005 Commercial License Usage
00006 
00007 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
00008 may use this file in accordance with the end user license agreement provided
00009 with the software or, alternatively, in accordance with the terms contained in a
00010 written agreement between you and Audiokinetic Inc.
00011 
00012 Apache License Usage
00013 
00014 Alternatively, this file may be used under the Apache License, Version 2.0 (the
00015 "Apache License"); you may not use this file except in compliance with the
00016 Apache License. You may obtain a copy of the Apache License at
00017 http://www.apache.org/licenses/LICENSE-2.0.
00018 
00019 Unless required by applicable law or agreed to in writing, software distributed
00020 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
00021 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
00022 the specific language governing permissions and limitations under the License.
00023 
00024 Version: <VERSION>  Build: <BUILDNUMBER>
00025 Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
00026 *******************************************************************************/
00027 
00028 #ifndef _AK_REFLECT_GAMEDATA_H_
00029 #define _AK_REFLECT_GAMEDATA_H_
00030 
00031 #include <AK/SoundEngine/Common/AkTypes.h>
00032 
00033 #define AK_MAX_NUM_TEXTURE 4
00034 
00035 /// Data used to describe one image source in Wwise Reflect.
00036 struct AkImageSourceName
00037 {
00038     AkImageSourceName()
00039         : uNumChar(0)
00040         , pName(NULL)
00041     {
00042     }
00043 
00044     void SetName(const char * in_pName)
00045     {
00046         pName = in_pName;
00047         if (pName)
00048         {
00049             uNumChar = (AkUInt32)strlen(in_pName);
00050         }
00051         else
00052         {
00053             uNumChar = 0;
00054         }
00055     }
00056 
00057     AkUInt32 uNumChar;                          ///< Number of characters in image source name.
00058     const char * pName;                         ///< Optional image source name. Appears in Wwise Reflect's editor when profiling.
00059 };
00060 
00061 struct AkImageSourceTexture
00062 {
00063     AkImageSourceTexture()
00064         : uNumTexture(1)
00065     {
00066         arTextureID[0] = AK_INVALID_UNIQUE_ID;
00067     }
00068 
00069     AkUInt32 uNumTexture;                       ///< Number of valid textures in the texture array.
00070     AkUniqueID arTextureID[AK_MAX_NUM_TEXTURE]; ///< Unique IDs of the Acoustics Texture ShareSets used to filter this image source.
00071 };
00072 
00073 struct AkImageSourceParams
00074 {
00075     AkImageSourceParams()
00076         : fDistanceScalingFactor(1.f)
00077         , fLevel(1.f)
00078         , fDiffraction(0.f)
00079     {
00080         sourcePosition.X = 0.f;
00081         sourcePosition.Y = 0.f;
00082         sourcePosition.Z = 0.f;
00083     }
00084 
00085     AkImageSourceParams(AkVector in_sourcePosition, AkReal32 in_fDistanceScalingFactor, AkReal32 in_fLevel)
00086         : sourcePosition(in_sourcePosition)
00087         , fDistanceScalingFactor(in_fDistanceScalingFactor)
00088         , fLevel(in_fLevel)
00089         , fDiffraction(0.f)
00090     {
00091     }
00092 
00093     AkVector sourcePosition;                    ///< Image source position, relative to the world.
00094     AkReal32 fDistanceScalingFactor;            ///< Image source distance scaling. This number effectively scales the sourcePosition vector with respect to the listener and, consequently, scales distance and preserves orientation.
00095     AkReal32 fLevel;                            ///< Game-controlled level for this source, linear.
00096     AkReal32 fDiffraction;                      ///< Diffraction amount, normalized to the range [0,1].
00097     bool bDiffractedEmitterSide;                ///< Indicates if there is a shadow zone diffraction just after the emitter in the reflection path.
00098     bool bDiffractedListenerSide;               ///< Indicates if there is a shadow zone diffraction before reaching the listener in the reflection path.
00099 };
00100 
00101 struct AkReflectImageSource
00102 {
00103     AkReflectImageSource()
00104         : uID((AkImageSourceID)-1)
00105         , params()
00106         , texture()
00107         , name()
00108     {}
00109 
00110     AkReflectImageSource(AkImageSourceID in_uID, AkVector in_sourcePosition, AkReal32 in_fDistanceScalingFactor, AkReal32 in_fLevel)
00111         : uID(in_uID) 
00112         , params(in_sourcePosition, in_fDistanceScalingFactor, in_fLevel)
00113         , texture()
00114         , name()
00115     {
00116     }
00117 
00118     void SetName(const char * in_pName)
00119     {
00120         name.SetName(in_pName);
00121     }
00122 
00123     AkImageSourceID uID;                        ///< Image source ID (for matching delay lines across frames)
00124     AkImageSourceParams params;
00125     AkImageSourceTexture texture;
00126     AkImageSourceName name;
00127 };
00128 
00129 /// Data structure sent by the game to an instance of the Wwise Reflect plug-in.
00130 struct AkReflectGameData
00131 {
00132     AkGameObjectID listenerID;                  ///< ID of the listener used to compute spatialization and distance evaluation from within the targeted Reflect plug-in instance. It needs to be one of the listeners that are listening to the game object associated with the targeted plug-in instance. See AK::SoundEngine::SetListeners and AK::SoundEngine::SetGameObjectAuxSendValues.
00133     AkUInt32 uNumImageSources;                  ///< Number of image sources passed in the variable array, below.
00134     AkReflectImageSource arSources[1];          ///< Variable array of image sources. You should allocate storage for the structure by calling AkReflectGameData::GetSize() with the desired number of sources.
00135     
00136     /// Default constructor.
00137     AkReflectGameData()
00138         : listenerID( AK_INVALID_GAME_OBJECT )
00139         , uNumImageSources(0)
00140     {}
00141 
00142     /// Helper function for computing the size required to allocate the AkReflectGameData structure.
00143     static AkUInt32 GetSize(AkUInt32 in_uNumSources)
00144     {
00145         return (in_uNumSources > 0) ? sizeof(AkReflectGameData) + (in_uNumSources - 1) * sizeof(AkReflectImageSource) : sizeof(AkReflectGameData);
00146     }
00147 };
00148 #endif // _AK_REFLECT_GAMEDATA_H_