New answers tagged

0

If it's the allocation of the Vector3 you're worried about you might consider keeping an instance as a private member of the class and re-use that; private final Vector3 v3 = new Vector3(); public void yourMethod() { if(cam.frustum.pointInFrustum(v3.set((float)posX, (float)posY, 0))) { } } Another way, if you have many of these instances you could ...


6

I can't see anything fundamentally wrong with the shader, but here are a few things I find commonly done wrong with deferred shading that you might be doing. 1: Drawing full screen lights. The beauty of deferred shading is that you can pack your lights into geometry so that you only need to consider a part of the screen when drawing them (Like a cube with 2 ...


1

I found myself that to speed up my nbody. Instead of iterating through all of i & j. With i=0, i++, j=0, j++ and setting the force of object i to fG. I can use i=0, i++, j=i+1, j++ and set the force of object i to fG and object j to -fG.


5

So the first thing I noticed was that when you do previousTouch = currentTouch; currentTouch.Clear(); this should also clear previous touch since List is a reference type. The second thing is that there is no space partitioning so your collision check currently runs in O(n^2) as best case runtime. The third thing is that it's weird that you calculate ...


1

Don't get caught up in the exact numbers used in the example. Those are not the main point. It's how they are relative to each other. You see that xhdpi 200x200 is twice as big as mdpi 100x100. Notice the if in the example. List of densities: xxhdpi: 3.0 xhdpi: 2.0 hdpi: 1.5 mdpi: 1.0 (baseline) ldpi: 0.75 Sample example but with different numbers: ...


7

I suspected OP already knew this approach so I mentioned it in a comment as just a starting point, but I'll try fleshing it out a bit more... Most physics engines divide dynamic objects into two groups, "awake," and "sleeping." Objects sleep when they sit at rest, and wake when moved or accelerated by some outside influence. A sleeping object behaves like ...



Top 50 recent answers are included