Version
menu_open
link

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

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise