Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Aug 2012
Offline Last Active Mar 28 2013 10:48 PM

Topics I've Started

Rock Band 3 piano support

12 October 2012 - 01:49 AM

Just wondering if anyone knows how to check the input from the RB3 keytar. The only thing I could find on google was this forum.

It's a start, but I'm just wondering if anyone knows of an existing library that could handle this? Otherwise if I figure it out I'll post something here.

Is it legal to make a game that uses a rock band peripheral?

particle effects billboarding issue[C++]

25 August 2012 - 11:11 AM

I've included pictures of whats happening as well as my "particle" image. The issue is i have a bunch a billboards showing a particle, but the alpha doesn't seem to be working in some cases, but it works in some cases. for instance if i stack the particleThis is an assignment I have for class

[source lang="cpp"]// render the grid d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); render_grid();d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); // calculate elapsed time static DWORD starting_point = GetTickCount(), time; time = GetTickCount() - starting_point; starting_point = GetTickCount();addParticles(); // prepare particle for renderingNode<Particle> *particle = particles.first;D3DXMATRIX patMat;float y = 0;while (particle != NULL){ particle->value->run_particle(time / 1000.0f); //particle->value->position.y = y; if(particle->value->isDead()) particle->value->reset(); patMat = particle->value->set_particle(camx, camy, camz); d3ddev->SetTransform(D3DTS_WORLD, &patMat); particle->value->render_particle(); // --- NEXT particle = particle->next; y += .05;}d3ddev->EndScene();[/source]
"particles" is a linked list, addparticles adds some particles to the list until the cap is reached, and when particle die they get reset. when i draw X amount of the particles at the same position, they all draw, andit looks like a brighter version of the particle, however when i move them randomly they loook like the images below heres the particle class:
[source lang="cpp"]#include <d3dx9.h>float random(float max, bool negative = true){ if(negative) return cos(float(rand()))*max; /*else*/ return abs(cos(float(rand())))*max;}// the Particle classclass Particle{protected: D3DXVECTOR3 velocity; D3DXVECTOR3 acceleration; float radius; D3DXMATRIX matRotateX; D3DXMATRIX matRotateY;public: D3DXVECTOR3 position; Particle(); void reset(); void render_particle(); D3DXMATRIX set_particle(float camx, float camy, float camz); void run_particle(float seconds); bool isDead();};Particle :: Particle(){ reset(); }void Particle :: reset(){ position = D3DXVECTOR3(random(0.5f), 0.0, random(0.5f)); velocity = D3DXVECTOR3(random(0.5f), random(1.0f, false)+0.5f, random(0.5f)); acceleration = D3DXVECTOR3(0.0f, 0.0f, 0.0f); radius = random(0.5f, false)+0.5f;}bool Particle :: isDead(){ return radius <= 0.0f; }// this is the function that positions, rotates, scales and renders the particleD3DXMATRIX Particle::set_particle(float camx, float camy, float camz){ // Before setting the world transform, do the intense mathematics! // a. Calculate the Differences static float difx, dify, difz; difx = camx - position.x; dify = camy - position.y; difz = camz - position.z; // ooh, intense! // b. Calculate the Distances static float FlatDist, TotalDist; FlatDist = sqrt(difx * difx + difz * difz); TotalDist = sqrt(FlatDist * FlatDist + dify * dify); // c. Y Rotation D3DXMatrixIdentity(&matRotateY); matRotateY._11 = matRotateY._33 = difz / FlatDist; // cosY matRotateY._31 = difx / FlatDist; // sinY matRotateY._13 = -matRotateY._31; // -sinY // d. X Rotation D3DXMatrixIdentity(&matRotateX); matRotateX._22 = matRotateX._33 = FlatDist / TotalDist; // cosX matRotateX._32 = dify / TotalDist; // sinX matRotateX._23 = -matRotateX._32; // -sinX // e. Tranlation static D3DXMATRIX matTranslate; D3DXMatrixTranslation(&matTranslate, position.x, position.y, position.z); // f. Scaling static D3DXMATRIX matScale; D3DXMatrixIdentity(&matScale); matScale._11 = matScale._22 = matScale._33 = radius; return matScale * matRotateX * matRotateY * matTranslate;}// this function updates the particlevoid Particle::run_particle(float seconds){ velocity += acceleration * seconds; position += velocity * seconds; radius -= seconds; return;}[/source]