Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Q3BSP shaders: I'm going mad :(

This topic is 5491 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I had some problems with Q3 BSP shader wave functions, it seems like they don''t run simoultan to the texture-change-animation, so I decided to directly copy some disel source into my C++ DLL (I''m using VB6, please don''t kill me ) and call it from my renderer, so I came up with this:
_declspec( dllexport ) int _stdcall GetCurFrame(float freq, int nFrames)
return (int)fmod(secs_passed * ((double)freq), ((double)nFrames));

_declspec( dllexport ) void _stdcall wSawtooth(WaveFunc &Wave, D3DCOLORVALUE *ARGB)
time = ((double)Wave.phase) + ((double)Wave.freq) * secs_passed;
time -= floor(time);
time = ((double)Wave.base) + ((double)Wave.amp) * time;
ARGB->a = (float)1;
ARGB->r = (float)time;
ARGB->g = (float)time;
ARGB->b = (float)time;

_declspec( dllexport ) void _stdcall InitTimer()



_declspec( dllexport ) void _stdcall StartTimer()

_declspec( dllexport ) void _stdcall StopTimer()


_declspec( dllexport ) double _stdcall GetSecs()
return secs_passed;
you will notice that I cast my variables very strictly, this is because I thought the problem would rely on internal rounding errors (but it doesn''t appears to...). InitTimer and StartTimer are called before entering the main loop, at the end of the main loop I just call StopTimer. When I encounter an face wich uses an RGBgen, I just use this call to change the emissive material property of my D3DMATERIAL: wSawtooth Waves(rgbGenData(CurStage.rgbGen).waveInd), ObjMaterial.emissive Waves(rgbGenData(CurStage.rgbGen).waveInd) holds the wave data (amplitude, freq, bla...) After the wave is calculated, I just set the material and activate lighting, so that it will affect the object D3Ddevice.SetMaterial ObjMaterial D3Ddevice.SetRenderState D3DRS_LIGHTING, 1 Perhaps I should explain my problem an little bit more, but I really don''t know the source of my problem, I think it''s within the code I posted here (I at least hope so...). Please help, I''m really lost

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!