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         , uDiffractionEmitterSide(0)
00080         , uDiffractionListenerSide(0)
00081     {
00082         sourcePosition.X = 0.f;
00083         sourcePosition.Y = 0.f;
00084         sourcePosition.Z = 0.f;
00085     }
00086 
00087     AkImageSourceParams(AkVector in_sourcePosition, AkReal32 in_fDistanceScalingFactor, AkReal32 in_fLevel)
00088         : sourcePosition(in_sourcePosition)
00089         , fDistanceScalingFactor(in_fDistanceScalingFactor)
00090         , fLevel(in_fLevel)
00091         , fDiffraction(0.f)
00092         , uDiffractionEmitterSide(0)
00093         , uDiffractionListenerSide(0)
00094     {
00095     }
00096 
00097     AkVector sourcePosition;                    ///< Image source position, relative to the world.
00098     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.
00099     AkReal32 fLevel;                            ///< Game-controlled level for this source, linear.
00100     AkReal32 fDiffraction;                      ///< Diffraction amount, normalized to the range [0,1].
00101     AkUInt8 uDiffractionEmitterSide;            ///< If there is a shadow zone diffraction just after the emitter in the reflection path, indicates the number of diffraction edges, otherwise 0 if no diffraction.
00102     AkUInt8 uDiffractionListenerSide;           ///< If there is a shadow zone diffraction before reaching the listener in the reflection path, indicates the number of diffraction edges, otherwise 0 if no diffraction.
00103 };
00104 
00105 struct AkReflectImageSource
00106 {
00107     AkReflectImageSource()
00108         : uID((AkImageSourceID)-1)
00109         , params()
00110         , texture()
00111         , name()
00112     {}
00113 
00114     AkReflectImageSource(AkImageSourceID in_uID, AkVector in_sourcePosition, AkReal32 in_fDistanceScalingFactor, AkReal32 in_fLevel)
00115         : uID(in_uID) 
00116         , params(in_sourcePosition, in_fDistanceScalingFactor, in_fLevel)
00117         , texture()
00118         , name()
00119     {
00120     }
00121 
00122     void SetName(const char * in_pName)
00123     {
00124         name.SetName(in_pName);
00125     }
00126 
00127     AkImageSourceID uID;                        ///< Image source ID (for matching delay lines across frames)
00128     AkImageSourceParams params;
00129     AkImageSourceTexture texture;
00130     AkImageSourceName name;
00131 };
00132 
00133 /// Data structure sent by the game to an instance of the Wwise Reflect plug-in.
00134 struct AkReflectGameData
00135 {
00136     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.
00137     AkUInt32 uNumImageSources;                  ///< Number of image sources passed in the variable array, below.
00138     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.
00139     
00140     /// Default constructor.
00141     AkReflectGameData()
00142         : listenerID( AK_INVALID_GAME_OBJECT )
00143         , uNumImageSources(0)
00144     {}
00145 
00146     /// Helper function for computing the size required to allocate the AkReflectGameData structure.
00147     static AkUInt32 GetSize(AkUInt32 in_uNumSources)
00148     {
00149         return (in_uNumSources > 0) ? sizeof(AkReflectGameData) + (in_uNumSources - 1) * sizeof(AkReflectImageSource) : sizeof(AkReflectGameData);
00150     }
00151 };
00152 #endif // _AK_REFLECT_GAMEDATA_H_