Tag Info

Hot answers tagged

4

The D3DX function D3DXMatrixOrthoOffCenterRH constructs an orthographic projection matrix based on the top/left/right/bottom coordinates of the view volume. Per the documentation, the formula used is: 2/(r-l) 0 0 0 0 2/(t-b) 0 0 0 0 1/(zn-zf) 0 (l+r)/(l-r) (t+b)/(b-t) zn/(zn-zf) ...


4

Long ago I did the math for different growth functions for an RPG (that I didn´t use in the end). I was playing around with five basic growth curves, as show below. The curves are: Red: Exponential. Grows slowly at the beginning, very fast at the end. Blue: Quadratic. Average growth curve. Black: Linear. Green: Flipped quadratic. Grows more slowly with ...


3

First of all: most computer trigonometric functions takes radians as input. Even if the code worked, I am 99% sure it will not rotate by 90 degrees. So if it is that case, try changing it to pi/2. Secondly, if you would rotate by not-multiply of 90 degrees - the code would still produce axis-aligned rectangle (bounding box), NOT rotated rectangle as you ...


3

Fly along circular arcs You start at x1, moving in the direction v1 and want to end up at x2 facing in v2, then the shortest path (assuming a finite turning radius, which realistically should be proportional to the square of the velocity) takes you along an arc of radius r1around m1, followed by a straight line segment and then another arc of radius ...


2

Your code is only sampling the corner texels, so is only valid for a 2x2 filter. Sample all the texels within your filter shape to achieve correct results.


2

Rather than use the legacy D3DXMath, consider using DirectXMath instead Plus you get all the source in the header. This computes the matrix as a row-major, right-handed matrix: inline XMMATRIX XMMatrixOrthographicOffCenterRH ( float ViewLeft, float ViewRight, float ViewBottom, float ViewTop, float NearZ, float FarZ ) { ...


2

Say the object is 10 meters above ground. Assume that our dt (delta t) is 1 second. The object goes to the height of 9 meters at the end of the first iteration Here lies your problem. It is true that the velocity at the end of the first iteration is 1 m.s¯¹. However during that time the object has not travelled 1 m. In fact, since the acceleration is ...


2

You could use a logarithmic function: Example function: double increment = Math.Log(level + 1); Example output: Level 1 increment: 0.693147180559945 Level 2 increment: 1.09861228866811 Level 3 increment: 1.38629436111989 Level 4 increment: 1.6094379124341 Level 5 increment: 1.79175946922805 Level 6 increment: ...


2

Yes, there are many performance implications to consider even when two objects share the same amount of geometry. Fragments that fail a Z-buffer test will not invoke fragment shaders. The amount of screen-space that the objects occupy will impact performance, as fill-rate is a big deal especially on mobile devices. If you have large triangles that are ...


1

Okay, my two cents: In your problem, I would try with a heavily modified Poisson-Disk-Sampling. This method will first Poisson-Sample a Sector, and, after sampling enough Sectors, will sample a universe. This means the algorithm runs in two phases. This may be costintensive! Some thoughts to it. Consider a Sector being a disk with radius sec, and a System ...


1

I'm probably looking at the problem from the wrong angle. Yes, you are. You are confusing "uniform" with "random". People intuitively think that random means "more or less equal in all space". That is wrong, because that is uniform. Truly random (or pseudorandom) tends to form clusters of points close together or very far away. Here is a picture ...


1

I think the main problem is that you are generating your sectors too closely together, so that according to your criteria, sectors too close will be discarded, thus leaving those sectors that are just far enough apart. This results in a tight packing, which would be a hexagonal grid if you use Euclidean distance, or a square grid if you use Manhattan. Is ...


1

historically billboards matrix just copy the camera view matrix, and replace the last row with their own world position. the scale can be world-fixed if you want trees or hard stuff. But it can also be screen-fixed for halo effects, in which case you need to scale using the euclidian distance. this can be done in the vertex shader rather than on CPU as an ...


1

You then have the centers of the BB without having to know the size of it, if your game needs to know the centers more often than the top left then that is preferable. Storing the half vectors is to simplify retrieving the left/right and bottom/top vectors center-halfHeight provides the bottom and center+halfHeight provides the top. Granted all it does is ...


1

Get the object's Normal as vector (X,Y,Z). I guess that will be (0,0,1) in your case. Construct rotation matrix from your angles (e.g. euler-to-matrix or any other "Euler to Matrix" instructions that suit you). Order of rotations is important. Multiply your Normal with Rotation matrix


1

You can do the trig functions yourself if you want, but it's a lot easier to use a rotation matrix. In the background it will do the exact same sin/cos stuff, but it's already programmed for you, so why redo it? I'm not too familiar with Irrlicht (or C++), but adapting some code I found on their forums, it'll probably look something like this: ...


1

I would add some AI (artificial intelligence) checks. A first thing to do would be to check if the distance to travel, in comparison with the distance to the enemy makes sense to apply the Bezier curves. For example, you could make the weight (i.e.: distance from the end point to the control point of the Bezier curve) depend on the distance travelled and the ...


1

To get the rotated sprites coordinate simply call the getVertices() method. For example: sprite.getVertices()[SpriteBatch.X2] Gets you the X coordinates of the top left corner. The same call but replacing X<number> with Y<number> gets you the Y coordinate. The corner numbers go like this: 2-3 | | 1-4


1

You may run into trouble if you're writing an algorithm which requires that you compute an optimized position. For example, let's say you had a set of objects, and you were trying to compute the position with the smallest total distance from all of the objects. Just for a concrete example, say we're trying to power three buildings, and we want to figure ...



Only top voted, non community-wiki answers of a minimum length are eligible