Reorganize ddsndgeometry code

Split linux geometry class implementation into own file, rename directx geometry.cpp to ds3dgeometry.cpp
This commit is contained in:
Azamat H. Hackimov 2024-05-20 12:03:22 +03:00
parent 45ac1cc78a
commit 283e003b73
6 changed files with 79 additions and 60 deletions

View File

@ -6,12 +6,13 @@ set(CPPS
ssl_lib.cpp
$<$<PLATFORM_ID:Windows>:
ds3dlib.cpp
ds3dgeometry.cpp
dsound3d.cpp
eax.cpp
geometry.cpp
>
$<$<PLATFORM_ID:Darwin,Linux>:
mixer.cpp
sdlgeometry.cpp
sdlsound.cpp
>
)

View File

@ -76,7 +76,7 @@ public:
// clears out geometry info
void Clear();
// primatives, nv = number of verts, and verts is an array of pointers to vertices.
// primitives, nv = number of verts, and verts is an array of pointers to vertices.
// you can pass a sound material value if you want special reflective properties on this polygon.
void AddPoly(int nv, vector **verts, unsigned tag, tSoundMaterial material = SNDGEO_MATERIAL_NONE);

63
sndlib/sdlgeometry.cpp Normal file
View File

@ -0,0 +1,63 @@
/*
* Descent 3
* Copyright (C) 2024 Parallax Software
* Copyright (C) 2024 Descent Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
///////////////////////////////////////////////////////////////////////
// llsGeometry
#include "ddsndgeometry.h"
// specify a sound library to associate geometry with
bool llsGeometry::Init(llsSystem *snd_sys) { return false; }
// closes low level geometry system.
void llsGeometry::Shutdown() {}
void llsGeometry::StartFrame() {}
void llsGeometry::EndFrame() {}
// clears out geometry info
void llsGeometry::Clear() {}
// polygon lists
// is a group cached?, check before rendering it.
void llsGeometry::IsGroupValid(int group) {}
// marks beginning of a list of polygons to render, (-1 group for non cache)
void llsGeometry::StartPolygonGroup(int group) {}
// ends a list of polygons to render.
void llsGeometry::EndPolygonGroup(int group) {}
// renders a group.
void llsGeometry::RenderGroup(int group) {}
// primatives, nv = number of verts, and verts is an array of pointers to vertices.
// you can pass a sound material value if you want special reflective properties on this polygon.
void llsGeometry::AddPoly(int nv, vector **verts, unsigned tag, tSoundMaterial material) {}
// 4 verts here.
void llsGeometry::AddQuad(unsigned tag, vector **verts) {}
// 3 verts here.
void llsGeometry::AddTriangle(unsigned tag, vector **verts) {}
void llsGeometry::CreateMaterial(tSoundMaterial material, float transmit_gain, float transmit_highfreq,
float reflect_gain, float reflect_highfreq) {}
void llsGeometry::DestroyMaterial(tSoundMaterial material) {}

View File

@ -18,7 +18,6 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstdarg>
#include <SDL.h>
@ -786,47 +785,3 @@ void lnxsound_ErrorText(const char *fmt, ...) {
static void StreamAudio(void *user_ptr, Uint8 *stream, int len) {
((software_mixer *)user_ptr)->StreamMixer((char *)stream, len);
}
///////////////////////////////////////////////////////////////////////
// llsGeometry
#include "ddsndgeometry.h"
// specify a sound library to associate geometry with
bool llsGeometry::Init(llsSystem *snd_sys) { return false; }
// closes low level geometry system.
void llsGeometry::Shutdown() {}
void llsGeometry::StartFrame() {}
void llsGeometry::EndFrame() {}
// clears out geometry info
void llsGeometry::Clear() {}
// polygon lists
// is a group cached?, check before rendering it.
void llsGeometry::IsGroupValid(int group) {}
// marks beginning of a list of polygons to render, (-1 group for non cache)
void llsGeometry::StartPolygonGroup(int group) {}
// ends a list of polygons to render.
void llsGeometry::EndPolygonGroup(int group) {}
// renders a group.
void llsGeometry::RenderGroup(int group) {}
// primatives, nv = number of verts, and verts is an array of pointers to vertices.
// you can pass a sound material value if you want special reflective properties on this polygon.
void llsGeometry::AddPoly(int nv, vector **verts, unsigned tag, tSoundMaterial material) {}
// 4 verts here.
void llsGeometry::AddQuad(unsigned tag, vector **verts) {}
// 3 verts here.
void llsGeometry::AddTriangle(unsigned tag, vector **verts) {}
void llsGeometry::CreateMaterial(tSoundMaterial material, float transmit_gain, float transmit_highfreq,
float reflect_gain, float reflect_highfreq) {}
void llsGeometry::DestroyMaterial(tSoundMaterial material) {}

View File

@ -64,16 +64,16 @@ public:
// Starts the sound library, maybe have it send back some information -- 3d support?
virtual int InitSoundLib(char mixer_type, oeApplication *sos, unsigned char max_sounds_played);
// Cleans up after the Sound Library
virtual void DestroySoundLib(void);
virtual void DestroySoundLib();
// Locks and unlocks sounds (used when changing play_info data)
virtual bool LockSound(int sound_uid);
virtual bool UnlockSound(int sound_uid);
virtual bool SetSoundQuality(char quality);
virtual char GetSoundQuality(void);
virtual char GetSoundQuality();
virtual bool SetSoundMixer(char mixer_type);
virtual char GetSoundMixer(void);
virtual char GetSoundMixer();
// Plays a 2d sound
virtual int PlaySound2d(play_information *play_info, int sound_index, float volume, float pan, bool f_looped);
@ -85,7 +85,7 @@ public:
virtual void AdjustSound(int sound_uid, float f_volume, float f_pan, unsigned short frequency);
virtual void AdjustSound(int sound_uid, pos_state *cur_pos, float adjusted_volume, float reverb = 0.5f);
virtual void StopAllSounds(void);
virtual void StopAllSounds();
// Checks if a sound is playing (removes finished sound);
virtual bool IsSoundInstancePlaying(int sound_uid);
@ -97,15 +97,15 @@ public:
virtual void StopSound(int sound_uid, unsigned char f_immediately = SKT_STOP_IMMEDIATELY);
// Pause all sounds/resume all sounds
virtual void PauseSounds(void);
virtual void ResumeSounds(void);
virtual void PauseSounds();
virtual void ResumeSounds();
virtual bool CheckAndForceSoundDataAlloc(int sound_file_index);
// Begin sound frame
virtual void SoundStartFrame(void);
virtual void SoundStartFrame();
// End sound frame
virtual void SoundEndFrame(void);
virtual void SoundEndFrame();
// returns the error string.
virtual const char *GetErrorStr() const;
@ -138,15 +138,15 @@ protected:
// This function limits the number of sounds cached to 255(8bits) and 256 bit is for invalid channel
// The purpose is to create unique signatures for each sound played (and allow for
// the slot_number to be quickly determined)
inline int MakeUniqueId(int sound_slot);
inline int ValidateUniqueId(int sound_uid);
inline int MakeUniqueId(int sound_slot) const;
static inline int ValidateUniqueId(int sound_uid);
// Sound System Error Handler.
void CheckForErrors(void);
void CheckForErrors();
void SetError(int code) { m_lib_error_code = code; };
void StartStreaming(void);
void EndStreaming(void);
void StartStreaming();
void EndStreaming();
int m_primary_frequency; // Set to the primary buffers frequency -- cmphack
int m_primary_alignment;