I'd say that
for(int I = 0; I < steps; I++) {
ymid = F(xn+stepSize*0.5f);
integral += ymid*stepSize;
xn += stepSize;
}is all what's needed for the midpoint method integration. But perhaps this is just a naming confusion!?
Male
Posted by haegarr
on 28 December 2012 - 02:46 AM
for(int I = 0; I < steps; I++) {
ymid = F(xn+stepSize*0.5f);
integral += ymid*stepSize;
xn += stepSize;
}is all what's needed for the midpoint method integration. But perhaps this is just a naming confusion!?
Posted by haegarr
on 24 December 2012 - 04:12 AM
Posted by haegarr
on 22 December 2012 - 03:45 AM
Not using the pitch but the method similar to "look-at" has a reason: It avoids to concatenate a rotation but instead is in itself a full-blown solution, i.e. it computes the end result instead of a delta that has to be applied. You can find parallels in some dozen threads about the look-at computation here in GDnet everywhere.
Looking at the original code snippet
XMVECTOR incline = XMVector3Dot(mCam.GetLookXM(), mTerrain.GetNormal(camPos.x, camPos.z)); ...
then mCam.GetLookXM() gives the vector m, and mTerrain.GetNormal(camPos.x, camPos.z) gives the vector n. You can compute all the mRight, mUp, and mLook from them.
Of course, also computing the matrix directly as above suffers from abrupt changes when the camera crosses edges of adjacent triangles with noticeably different normals. If you want smoothness in those situations, a possibility may be what I've described in the previous post: Assume that the height field is spaced 10 by 10 length units. Assume further that you use a forward vector with a length of 2 length units (i.e. a scaled mCam.getLookXM() vector). Then compute the position (inclusive height) of the camera as well as of the point at the end of the forward vector but again projected onto the terrain. Then use the difference vector as new look-along vector. As long as the camera is more or less in the middle of a triangle, the result will be the same as with the other methods of computation. But when the end of the forward vector falls beyond an edge of the triangle (i.e. in the given example it is closer than 2 length units to the edge), then the other triangle influences the result, and that the more the camera gets closer to the edge. Just after crossing the edge, the new triangle has 100% influence on the result. If you are heading the camera to look back than the just left triangles gets most of its influence back.
Posted by haegarr
on 21 December 2012 - 12:50 PM
Posted by haegarr
on 04 November 2012 - 04:22 AM
Posted by haegarr
on 07 October 2012 - 03:05 AM
Posted by haegarr
on 14 August 2012 - 01:11 PM
Posted by haegarr
on 10 August 2012 - 07:44 AM
Posted by haegarr
on 19 June 2012 - 11:26 PM
Informations can be gathered from several impersonal and personal sources like...
How would do you think this could be implemented without saying "This was is long but less to fight, this way is shorter with more to fight!" directly to the player?
Posted by haegarr
on 26 May 2012 - 03:30 AM
You have a viewing volume in general. Before normalization it is a "frustum" in case of perspective projection but a cuboid in case of orthographic projection. The projection matrix is responsible to squeeze the viewing volume into the normalized viewing volume which is in fact a cube ranging from -1 to +1 in each dimension. However, you need more to described than how to squeeze the volume: you need to describe where in the space the volume is located and how it is orientated. The both standard projection matrices are defined in a way that the viewing volume has an origin at 0 and OpenGL's standard viewing orientation. I other words, the projection expects to be applied in a local space that is called the viewing space.The opengl projection matrix is about defining the viewing frustum and perspective or orthopraphic projection... so... are the clipped coordinates the coordinates that lay in the viewing frustum? Which is definied by the projection matrix? That would explain why to get the clipped coordinate one has to multiply the projection matrix and the eye coordinate.
The modelview matrix is a combinaton of the model and the view matrix. It is used for doing transformations to a given vertex (scale, rotate and position). OpenGL doesn't use a "camera" or it can be thought of as the camera always being at (0,0,0) looking down the -Z axis. In order to change one's view, they need to transform all the objects positions so it's as if the world is moving around the "camera" not the "camera" moving around the world.
Posted by haegarr
on 21 May 2012 - 03:20 PM
Scene graphs are an example of violating the principle of single responsibility. It is used for logical grouping, assembling models, defining parent-child transformation hierarchies, doing spatial partitioning, ... all at once.Quick question, why are scene graphs deprecated ?
Posted by haegarr
on 19 May 2012 - 10:53 AM
Posted by haegarr
on 19 May 2012 - 07:20 AM
Posted by haegarr
on 18 May 2012 - 12:32 PM
Yes, for now I only do alike also for the listener:
alListener3f(AL_POSITION, cH/10,cY/10,(lZ/10)+disX);
cH is the heading degree and disX the distance.
Posted by haegarr
on 18 May 2012 - 01:30 AM
Find content