Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Apr 2001
Online Last Active Today, 03:24 AM

Posts I've Made

In Topic: How do you deal with tons of different same fundamental data types?

26 September 2015 - 03:07 PM

@alessio1989 sorry for the downvote, I hit the -1 button when trying to go back to previous page from my phone, it was not my intention to downvote

In Topic: Getting Rid of "char*"

26 December 2014 - 01:25 PM

Maybe you should reconsider using char*. I think const char* is the best solution in many situations. Having a function that accepts a cost char* means you can almost always use that function without tricks; having a fn that wants std::string or whatever, means you have always to convert your data to a string object before you can call that fn. Say you load a file in memory, then you need to process it in some way. If you use plain char*, you can just use the file in memory as is. If you use strings, you have to convert a "natural" char* in a string before using it.

In Topic: Rendering commands container implementation dilemma

24 August 2014 - 08:00 AM

You got it right. There's no need to store an end of command since, after you've read the command ID you should know exactly which params should follow,and then you should know how many bytes to read till the next command. You may instead want to use a special command and append it at the end of the stream so that, when reading the buffer, you can easily understand if you reached the end of the command list. This command list is API agnostic so you can use with dx/ogl, since it's up to you to define which command your list will support

In Topic: Rendering commands container implementation dilemma

23 August 2014 - 06:25 AM

I use a buffer, with a counter that "points" to the first free byte ( starts at 0 ends at buffer size -1). Every command is a byte (sort of command ID) followed by additional bytes (ie parameters) if needed. If I run out of space, I simple realloc the buffer giving it some more memory than before. During debug, I break on this reallocations so to have an idea of how much memory a buffer needs and with this data, I prealloc the buffer at startup. To my experience, prealloc a few kb (2 or 3) will be more than sufficient and rarely will run out of space.

In Topic: Voxel-based lighting

21 August 2014 - 08:47 AM

Couldn't you add a single bit for each voxel that tells you of the voxel is already in light list or not?