Inside3D!
     

MP3 or Ogg Support
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Wed Nov 18, 2009 11:15 am    Post subject: Reply with quote

ah i see Smile another todo on my long list of things Confused

btw i couldnt get your normalmapping code working on alias models
(due to the way there calculated i think) so im looking into nagging of the code from quake2xp for alias model normalmaps.

also i noticed some strange code you had in gl_rmain.c for calculating the leafs with the entity mins/maxs but the code doesnt seem to link to anything cause the mins/maxs are calculated after the call to the function that finds the correct modelleaf ?

so i did it like this

Code:
      // get entity origin
      VectorAdd (ent->origin, ent->model->mins, ent->mins);
      VectorAdd (ent->origin, ent->model->maxs, ent->maxs);

      // approximate the correct leaf for the entity in order to properly set fog and caustics.
      // this isn't 100% accurate (no method ever could be unless we use water surfs as clipping
      // planes) but it suffices pretty good for id1
      ent->modelleaf = R_LeafForEntity (ent->mins, ent->maxs);


before it was

// approximate the correct leaf for the entity in order to properly set fog and caustics.
// this isn't 100% accurate (no method ever could be unless we use water surfs as clipping
// planes) but it suffices pretty good for id1
ent->modelleaf = R_LeafForEntity (ent->mins, ent->maxs);

// get entity origin
VectorAdd (ent->origin, ent->model->mins, ent->mins);
VectorAdd (ent->origin, ent->model->maxs, ent->maxs);
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 910

PostPosted: Wed Nov 18, 2009 1:04 pm    Post subject: Reply with quote

Jesus I don't know! Laughing

That's about 4 or 5 year old code isn't it? I think it's relating to setting a correct fog colour on underwater entities when you have both underwater fog and translucent water enabled, but even that much I'm guessing.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Wed Nov 18, 2009 2:55 pm    Post subject: Reply with quote

correct Wink you do remember quite good Razz

my question was merely to find out if my way is correct cause ent->mins/maxs arent initialized anywhere so the data must come from the modelorigin (atleast thats what the same code does on brushmodels) and in that order Wink
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 910

PostPosted: Wed Nov 18, 2009 5:27 pm    Post subject: Reply with quote

I'd have to look over the implementation of R_LeafForEntity to be certain what the intent was, but I have a hunch that you're correct and that I had missed that part. Very Happy
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
reckless



Joined: 24 Jan 2008
Posts: 390
Location: inside tha debugger

PostPosted: Wed Nov 18, 2009 8:51 pm    Post subject: Reply with quote

oki ill leave it like it is for the moment Wink

no adverse effects noticed alltho before there where none either Smile

btw i implemented your alpha transparency sorting and moved it clientside works quite good it seems Very Happy

i somehow broke culling though Laughing need to look over the code some more ive split a lot of the stuff in it into seperate functions (it was starting to be a bit messy in there) Razz
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Tue Jun 01, 2010 3:09 am    Post subject: Reply with quote

mh wrote:
bgmvolume is there isn't it? It never worked on the CD cos a lot of CDs were just 0 or 1 for volume.

My current code for volume goes something like this:
Code:
   void AdjustVolume (void)
   {
      // ensure that we can change volume
      if (!this->ds_Audio) return;

      long db;

      // whoever in ms designed this must have really prided themselves on being so technically correct.  bastards.
      // decibels are great if you're an audio engineer, but if you're just writing a simple sliding volume control...
      if (bgmvolume.value <= 0)
         db = -10000;
      else if (bgmvolume.value >= 1)
         db = 0;
      else
         db = log10 (bgmvolume.value) * 2000;

      // set the volume
      this->ds_Audio->put_Volume (db);
   }


The version used in the Realm codebase was a much cruder earlier take on it that precalculated the log10 in discrete steps.

A version of the above should work just fine; you just need to check for a change in the value of bgmvolume and change the this->ds_Audio pointer to pAudio.


I have volume changing working fine now. Ironically, the question I asked here I shouldn't have needed to ask had I looked through the code properly.

Anyway, thanks again MH and Reckless.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
hondobondo



Joined: 26 Sep 2006
Posts: 102

PostPosted: Tue Jun 15, 2010 6:17 pm    Post subject: i got fmod to play mp3s Reply with quote

in bengts nehquake. but it violated copyrights according to leilei so i took it down. couldn't get it to load automatically like a cd player (i.e., darkplaces) i have the source around here somewhere...
Back to top
View user's profile Send private message
mh



Joined: 12 Jan 2008
Posts: 910

PostPosted: Tue Jun 15, 2010 9:19 pm    Post subject: Reply with quote

Nothing illegal about linking to fmod aside from what GPL weenies would like to have you believe. It's a proprietary library for sure, but so is user32 (which all Windows programs link to), so is kernel32 (which all Windows programs link to) and so even is opengl32.

If linking to fmod is illegal then linking to opengl32 is also illegal.

There was a scare about this back in the QuakeSrc.org days for sure, and it was based on info quite possibly originally provided and spread by FSF FUD-mongers who believe in the racial blood purity of Free ("thou shalt not use any definition of the word 'free' other than the one I choose") software.

But think about it logically. The GPL permits linking a GPL program to external libraries. Nothing wrong with using fmod.
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Tue Jun 15, 2010 9:55 pm    Post subject: Reply with quote

The GPL doesn't stop you linking to anything.
It stops you from distributing such derivative works.

opengl32, user32, kernel32 are all system componants of windows/linux/macosx/etc, and are allowed under the GPL:
Quote:

However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable

They're import libraries are part of the compiler.
X11 is generally considered a major component of linux systems, and is compatible anyway.

You may not distribute binaries that are statically linked to fmod. It is a violation of the GPL.

You *might* be able to get away with dynamic linking, but any headers that you import, any static libraries, must have a GPL compatible license. It must be a generic plugin API in its aproach.


If you really want to load mp3s in a quake engine without violating the GPL, load them via pipes through a separate program. There are no legal qualms here, other than actual distribution of the two programs. Then you can play oggs just as easily as you can mp3s. :P
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
mh



Joined: 12 Jan 2008
Posts: 910

PostPosted: Tue Jun 15, 2010 10:33 pm    Post subject: Reply with quote

I would have thought this section of the GPL means statically linkiing to fmod is OK:
Quote:
If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.


Even if it doesn't (and I'm dubious about the "distribute them as separate works" part) the GPL FAQ entries here and here specifically cover linking non-free non-system libraries with GPL programs and explicitly state that it's OK to do so (so long as you add a special exception that covers it - sample text given).
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Tue Jun 15, 2010 10:56 pm    Post subject: Reply with quote

Your quote does not consider the sentance that follows it, which directly refers to the exception of your quoted sentance.

Also, you can't add an exception unless you are the sole copyright owner of the GPL parts, id software would not agree with this.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Tue Jun 15, 2010 11:00 pm    Post subject: Reply with quote

mh wrote:
I would have thought this section of the GPL means statically linkiing to fmod is OK


No that absolutely isn't allowed.
_________________
Tomorrow Never Dies. I feel this Tomorrow knocking on the door ...
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Tue Jun 15, 2010 11:02 pm    Post subject: Reply with quote

mh wrote:
I would have thought this section of the GPL means statically linkiing to fmod is OK:
Quote:
If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.


I'd say that "identifiable sections of work that are not derived from the Program" is a gray area in GPL and subject to a lot of valid questioning. Better to use a linked library under a GPL-compatible license.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
mh



Joined: 12 Jan 2008
Posts: 910

PostPosted: Wed Jun 16, 2010 12:17 am    Post subject: Reply with quote

As an acceptable solution somebody could create a GPL static lib that links to fmod and then include the exception in that. They would own the copyright for the GPL lib and other GPL programs would be able to link to it without any issues.

This isn't about arguing just for the sake of it, it's about trying to find a solution that would enable people to do stuff. Wink
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Wed Jun 16, 2010 12:59 am    Post subject: Reply with quote

mh, your gpl static lib would require an exception as it is would not otherwise be able to comply with the gpl (mp3 decoders see section 8, have fun in the US), and would thus not be compatible with quake's exception-less gpl.
You can't just add exceptions to someone else's copyright.

You want a solution? Follow Carmack's (security) suggestion.
Create a child process, pipe the source file to it, read the pcm data back. That complies (ogg123 or mp3123 or whatever it is, both are commandline-based decoders). You can plug whatever decoder you want in there, and its not the engine imposing the decoder. The catch is that the user needs to download it themselves.

This is complicated by the fact that a Quake engine which depends upon non-gpled work is somewhat dubious, but considered okay, as you can always replace that with, eg, nexuiz.... well, bad example, but you get the idea.
Also, DirectX SDKs are not gplable. DirectX may be a system componant, but the sdk is not. And compilers generally do not have the most recent SDK, and thus the recent versions are not compatible with the gpl, until a newer compiler version is out...
Its all rather messy tbh.

Thankfully, I am not a lawyer! And because I said that, you're not allowed to sue me, mmkay?
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 2 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group