n2liquid's sandbox

Me, Sluggish Cognitive Tempo (SCT), C++, and SonettoJS

Posted on: June 5, 2011

I have around 9…

C++ class interfaces to write before SonettoJS development can proceed, plus their Direct3D implementations

Those are:

  • Texture

    Houses a GPU texture resource. It has a target channel, format, width, height, mipmap depth, and the texture data (which’s actually inside a GPU buffer).

  • IndexBuffer

    Houses an array of indices in GPU memory. It basically contains a switch determining the index format (16- or 32-bit), a length, and the index data (which’s, again, inside a GPU buffer).

  • VertexBuffer

    Is the same but for vertices. It contains a vertex declaration which specifies the format of each vertex (what data, e.g. position, normal, color, texture coordinates, etc., is available for each vertex and its offset relative to the beginning of the vertex), a length and the vertex data itself (held by the GPU).

  • PixelShader and VertexShader (or maybe a mixed ShaderProgram)

    Hold pixel (also called “fragment” in OpenGL) and/or vertex shaders. They simply receive the shader data and manage it in GPU memory.

  • ShaderConstant

    Represent a shader constant (contrary to what that page looks like, shader constants are also available in shader models prior to 4; shader constants are also called “uniforms” in OpenGL). These are parameters sent to the shader programs that don’t change while it executes, e.g. lighting data, the current time or a deformed skeleton used for hardware skinning.

  • FillMode

    Just holds the way triangles are meant be be filled. This can be either “solid” or “wireframe”.

  • BackFaceCullingMode

    Expresses how triangles are meant to be back-face culled. This can be “none” (culling disabled), “clockwise” or “counter-clockwise”.

  • PixelBlending

    Controls how drawn objects are blended with their target surface. Pixel blending (known as “alpha blending” in Direct3D, when in fact it may not use alpha information at all; that’s why I call it pixel blending) can be enabled or disabled. If enabled, the blending depends on three parameters: blend operation and source and destination blend factors.

Those are pretty simple to implement, and once written will allow me to do a lot of 3D job already. Although there are other important things beyond them, I preferred to delay thinking about that at least until I can get around to implement those first.

I’m pretty confident these are all absolutely required, and also pretty confident I know how to implement each.

But I just can’t get around writing them because it seems so fucking downright boring!!!

Conceptually they’re nice, in practice an infinite amount of fancy stuff can be done with them, but implementing these classes just suck.

Especially because I have to write them in C++…

I hate when code doesn’t fully capture my thoughts

And C++ really isn’t helping me at that lately.

You see, each class is actually an interface whose implementations must conform to. I can ensure all implementations will feature all the mandatory methods through inheritance, but I still can’t ensure the users of the implementation classes will be able use them absolutely as if they were using their interfaces, because there’s no way I can formally enforce a class will be constructible in any given way.

The abstract factory pattern is exactly what I would need, but I couldn’t find any satisfactory way to use it in this case.

*STROKES AN INSIGHT*

Until now, that is, because writing this post made me suddenly come up with an idea!

How does SCT relate to all this?

My point here is that I had a handful to write in these damn past two weeks (for chrissake, two breathing weeks threw out through the window), but I didn’t feel energy to write a single useful line because I was stuck thinking how it was all boring and that I didn’t know how to solve the construction problem.

I slept a lot, even drunk the hell outta myself three days ago, because even wanting so bad to work on this, even feeling that my whole life depended on it, and knowing that there were things I could write beyond the fucking class constructors, I didn’t manage to work.

And the worst part is that now that I’m feeling I know how everything clicks together, writing the classes don’t even feel boring anymore! How can one explain that? I’ve just said doing that was boring inside an h2 tag and suddenly it doesn’t seem boring anymore, because I’m excited feeling that I can sit down, write the code and be sure everything will be into place the way I intended them to be.

There are three equally plausible answers or a combination thereof: 1) SCT fucks me up and will eventually fuck up my whole life, 2) I’m a spoiled little brat that won’t do things unless they’re exactly the way I want, or 3) I really am just lazy and will only work when excited.

If anyone out there suffers the way I do, I’d really want to meet such a person

In teh world wild webz there’s bound to be someone who feels the same as me. If you’re reading this and you do feel like that, or if you know somebody who’s just like this, please contact me.

I’ll go crazy if I can’t understand what’s happening to me and how can I work around this problem.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Cute bouncing pixels

un.ma.i!

Twitter (technical)

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Twitter (personal)

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Get messaged when I post something new!
Just enter your e-mail and hit Follow:

Join 171 other followers

%d bloggers like this: