Hey there fellas!
I have three problems for first. More to come yet, I bet.
Though, I didn't scrape the whole forum yet, I still don't get the function recalculateBoundingBox() if it isn't able to fetch a Mesh's bounding vertexes and calculating it by itself. So how could it even recalculate a changed mesh buffer?
Then concerning getSceneNodeFromRayBB; I read that darn good explanation from rogerborg with that bit masking, but what if the enemies should be able to shoot themselves.
I got a solution in mind to place the line perpendicular to the bounding box, but I thought I might ask if there is a better solution.
Finally the most important: I got three or more light scene nodes and one attached right on the camera. Two are displaying correctly and one is just shown if I get right near the creation position. The one attached to the cam cast's no light, no matter what I do. (expect I disable all the other lights). So is there any good reason for this or has someone written a basic tutorial about lighting?
Best thanks in advance!
Concerning BoundingBox, getSceneNodeFromRayBB and Lights
-
- Posts: 13
- Joined: Sat Apr 19, 2008 5:05 pm
- Location: Switzerland
- Contact:
-
- Posts: 13
- Joined: Sat Apr 19, 2008 5:05 pm
- Location: Switzerland
- Contact:
I'm getting the same results with OGL and D3D.
Here the scene with the 4 Lights (the cam light isn't working) :
And as soon as the red light get's near the camera, its light is cast but the static yellow light dissapears...
And this is how one mesh object is generated. Perhaps that helps.
EDIT:
The strange thing is, the IAnimatedMeshes are lighted correctly as it seems and the Shadow Volume is working as well.
Ignore the strange Bounding Box... seems like I have to do some research first on how the box is aligned with the animated mesh.
I hope I don't confuse you too much with this and best thanks in advance.
Here the scene with the 4 Lights (the cam light isn't working) :
And as soon as the red light get's near the camera, its light is cast but the static yellow light dissapears...
And this is how one mesh object is generated. Perhaps that helps.
Code: Select all
SMesh* CMapObject::createMesh(EDirections dir) {
u16 indices[] = { 0,2,3, 2,1,3, 1,0,3, 2,0,1 };
SMeshBuffer* mBuf=new SMeshBuffer();
SMesh* newmesh=new SMesh();
mBuf->Vertices.push_back(S3DVertex(faces[dir][0], faceNormals[dir], SColor(255,255,255,255),vector2df(0,0)) );
mBuf->Vertices.push_back(S3DVertex(faces[dir][1], faceNormals[dir], SColor(255,255,255,255),vector2df(1,0)) );
mBuf->Vertices.push_back(S3DVertex(faces[dir][2], faceNormals[dir], SColor(255,255,255,255),vector2df(1,1)) );
mBuf->Vertices.push_back(S3DVertex(faces[dir][3], faceNormals[dir], SColor(255,255,255,255),vector2df(0,1)) );
// set the indices
for(int i=0;i<12;i++)
mBuf->Indices.push_back(indices[i]);
newmesh->addMeshBuffer(mBuf);
aabbox3d<f32> box=newmesh->getBoundingBox();
box.reset(faces[dir][0]);
box.addInternalPoint(faces[dir][1]);
box.addInternalPoint(faces[dir][2]);
box.addInternalPoint(faces[dir][3]);
newmesh->setBoundingBox(box);
return newmesh;
}
EDIT:
The strange thing is, the IAnimatedMeshes are lighted correctly as it seems and the Shadow Volume is working as well.
Ignore the strange Bounding Box... seems like I have to do some research first on how the box is aligned with the animated mesh.
I hope I don't confuse you too much with this and best thanks in advance.
-
- Posts: 13
- Joined: Sat Apr 19, 2008 5:05 pm
- Location: Switzerland
- Contact:
All righty then... I left that lighting issue be and stuck to a directional light for first.
In the meantime I made that bounding box wrapping 'round the model correctly and the shooting works well. With one little glitch; if I play a death animation and set the FrameLoop to the very end of the animation it strangely jerks back 3-5 Frames for a blink of an eye before the model loops on the end frame.
Here's the callback function where I check if one of the last frames of the MD2 death animation were hit:
Has anyone had this problem before or could someone please give me a hint?
If I iterate manually through the frames with setFrameLoop() there's no jerking and no frame jumping like this. I'm confused as confused gets...
In the meantime I made that bounding box wrapping 'round the model correctly and the shooting works well. With one little glitch; if I play a death animation and set the FrameLoop to the very end of the animation it strangely jerks back 3-5 Frames for a blink of an eye before the model loops on the end frame.
Here's the callback function where I check if one of the last frames of the MD2 death animation were hit:
Code: Select all
virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node)
{
node->setLoopMode(true);
if( (node->getFrameNr()==759)or(node->getFrameNr()==735)or(node->getFrameNr()==791) ) {
Log("atleast getting here... %0.1f\n", node->getFrameNr());
node->setAnimationSpeed(0);
node->setFrameLoop(node->getEndFrame(), node->getEndFrame());
}
else {
node->setMD2Animation(EMAT_STAND);
}
}
If I iterate manually through the frames with setFrameLoop() there's no jerking and no frame jumping like this. I'm confused as confused gets...