mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
fix: optimization: PVS-Studio warning V813
Passing large objects by const reference avoids unnecessary copying and enhances efficiency. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
parent
5b325ac2bc
commit
2c1103307f
42 changed files with 173 additions and 144 deletions
|
|
@ -40,7 +40,8 @@ namespace AL {
|
|||
/// @param field enum value
|
||||
/// @param def default value will be returned in case of error
|
||||
/// @return field value or default
|
||||
inline glm::vec3 getSource3f(uint source, ALenum field, glm::vec3 def={}) {
|
||||
inline glm::vec3 getSource3f(uint source, ALenum field, const glm::vec3& def= {}
|
||||
) {
|
||||
glm::vec3 value = def;
|
||||
if (source == 0)
|
||||
return def;
|
||||
|
|
|
|||
|
|
@ -210,10 +210,10 @@ std::unique_ptr<Stream> audio::open_stream(std::shared_ptr<PCMStream> stream, bo
|
|||
|
||||
|
||||
void audio::set_listener(
|
||||
glm::vec3 position,
|
||||
glm::vec3 velocity,
|
||||
glm::vec3 lookAt,
|
||||
glm::vec3 up
|
||||
const glm::vec3& position,
|
||||
const glm::vec3& velocity,
|
||||
const glm::vec3& lookAt,
|
||||
const glm::vec3& up
|
||||
) {
|
||||
backend->setListener(position, velocity, lookAt, up);
|
||||
}
|
||||
|
|
@ -310,7 +310,7 @@ speakerid_t audio::play(
|
|||
|
||||
speakerid_t audio::play_stream(
|
||||
const fs::path& file,
|
||||
glm::vec3 position,
|
||||
const glm::vec3& position,
|
||||
bool relative,
|
||||
float volume,
|
||||
float pitch,
|
||||
|
|
|
|||
|
|
@ -399,10 +399,10 @@ namespace audio {
|
|||
/// @param lookAt point the listener look at
|
||||
/// @param up camera up vector
|
||||
void set_listener(
|
||||
glm::vec3 position,
|
||||
glm::vec3 velocity,
|
||||
glm::vec3 lookAt,
|
||||
glm::vec3 up
|
||||
const glm::vec3& position,
|
||||
const glm::vec3& velocity,
|
||||
const glm::vec3& lookAt,
|
||||
const glm::vec3& up
|
||||
);
|
||||
|
||||
/// @brief Play 3D sound in the world
|
||||
|
|
@ -457,7 +457,7 @@ namespace audio {
|
|||
/// @return speaker id or 0
|
||||
speakerid_t play_stream(
|
||||
const fs::path& file,
|
||||
glm::vec3 position,
|
||||
const glm::vec3& position,
|
||||
bool relative,
|
||||
float volume,
|
||||
float pitch,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue