Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 03 Jul 2006
Offline Last Active Private

Posts I've Made

In Topic: C# - Detect If Pre-Existing .DDS Contains Alpha Channel?

25 August 2016 - 05:05 PM

I think testing DDPF_ALPHAPIXELS is only going to work reliably for uncompressed textures. If it's say a DXT5 texture then it could leave that flag clear and still work correctly. It would also be possible to generate a file where that flag is set, but the alpha channel is actually set to opaque for every pixel.


If you want to be certain, the easiest option is probably to convert to an uncompressed format, and read back the alpha channel. Of course for DXT5 you can be fairly certain there is an alpha channel - for opaque textures DXT1 is equivalent quality, and half the file size as it doesn't store full alpha data. However, a DXT1 image may or may not use the single bit alpha channel feature.


Of course most of the time game toolchains work the other way round - they start with uncompressed RGBA images and convert to .DDS to reduce the memory cost. When you're doing that you can make sure your converter sets a flag somewhere.


Also note that DXT is lossy compression. You will get better quality results if your tools work with uncompressed (or losslessly compressed) textures, and convert to .DDS as the final step.

In Topic: Decent vector library for C?

22 August 2016 - 03:54 PM

The standard Microsoft SSE wrapper library is DirectXMath. Is that the sort of thing you're looking for?


If not what functionality are you after?

In Topic: lpCmdLine, open with and spaces

14 August 2016 - 05:22 AM

You have one small bug there - you're not freeing the memory correctly.


From the documentation:


CommandLineToArgvW allocates a block of contiguous memory for pointers to the argument strings, and for the argument strings themselves; the calling application must free the memory used by the argument list when it is no longer needed. To free the memory, use a single call to the LocalFree function.

In Topic: lpCmdLine, open with and spaces

13 August 2016 - 05:47 PM

The standard windows function to parse the command line into the more usual argc and argv format is CommandLineToArgvW().


It does handle quoted arguments.

In Topic: For Loop Max Bug

08 August 2016 - 04:40 PM

However, this means, that when adding points to the volume, I either have to ADD ONE to the maxes when adding points, or add one to the maxes AFTER adding all the points. Adding one to the maxes during the add is a needless extra computation (when you are dealing with thousands of points). But it is possible to FORGET to add one to the maxes after adding the points, leading to subtle bugs, which should be something I am detecting at compile time, rather than relying on remembering to deal with.


I'd recommend writing code primarily for readability and correctness, unless it involves a big sacrifice of performance to do so. You can always try to optimize any bottlenecks found by your profiler later on.


In that particular case there's a good chance that the compiler will work out that it can move the +1 outside of the loop anyway.


It sounds like you might also benefit from some unit tests, so that you can find out about things that get broken at compile time (assuming you run the tests at the end of each successful build).