Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 May 2000
Offline Last Active Yesterday, 12:19 PM

Posts I've Made

In Topic: Yet Another Rendering Queue Thread

14 July 2014 - 07:02 PM

Personally, I would have something like
struct DrawableKey { u32 sortKey; Drawable* item; }; vector<DrawableKey> renderQ;
and then use std::sort to sort the vector using the key. If the vector contains thousands of items, then a radix sort / counting sort might be faster.


Going to try this.  Might do an index instead of the pointer for round one.



You just need different textures to have different integers. Different textures already have different pointers, so you can use some ugly code to convert a pointer to an integer:
Texture* texturePtr = ...;
ptrdiff_t texturePtrAsInteger = *(ptrdiff_t*)&texturePtr;

Apparently I'm kinda stuck with something like this. 

I tried creating my own texture inheriting from the sf::Texture to add the texID integer in there.

Then I started inheriting a new RenderStates type from sf::RenderStates.  But then painted myself into a corner because it's implementation uses an sf::Texture and there isn't really a way I can see to override that to use my type without reimplementing the entire thing.  Kinda hokey.



If you haven't already seen it, I found this to be very useful for queuing and sorting draw calls: http://realtimecollisiondetection.net/blog/?p=86.  As he draws the scene, he fills an array with key value pairs where the key is the sort key and the value is a pointer to the draw call data like described by Hodgman above

Yeah, I've seen that one.  Also there's a few good ones on LSpiro's page.  Good explanation of the concept, but not enough ideas for implementation for my programming inept skill level.



In Topic: Drag equation

13 June 2014 - 08:35 AM

I would be inclined to treat the wing and tail as two lifting surfaces and then apply some NACA Lift & Drag curves.

You could do a similar thing for the fusalage (treat it as a long-chord wing section). 

In Topic: Calculating pressure transfer between pipes

30 May 2014 - 12:27 PM

If it's for a game, it's got to be a pretty strange game where the incompressible assumption causes problems.


If it's for an engineering problem, there are off the shelf products both paid and open to solve fluid problems.  Computational Fluid Dynamics code.


If it's purely to learn and play:

When you lose the incompressible assumption it becomes simultaneously a fluid dynamics and thermodynamics problem. 

You will need to learn about:

Bernoulli / Energy equation

Thermodynamic Properties

The basic laws of thermodynamics


It's a big subject and it's hard to advise you more specifically without knowing where you are starting from.

In Topic: Modeling some flight physics.

16 May 2014 - 07:08 AM

I think you're having a hard time because you may not be clear what your end goal should look like.  A well described question is halfway answered.


You say it's on rails.  But then you want to account for angle of attack and wingspan while having a constant force driving you forwards.  You seem to be creating a hodgepodge of rails and physics based behavior.  I caution that such a hybrid may create strange edge-case behaviors and may tend to be unintuitive.


Let's break this down to the simplest forces you need to fly.  Airplane, dragon, whatever.

Lift, thrust, drag, gravity.


You can use simple lift coefficient for lift force.

Its sounds like you want thrust to be constant forward. 

You can use simple drag coefficients to get a drag force.

Gravity is gravity.


For your rotional control you have 3 axis.

Pitch, roll, yaw.


Here is where you need to better define your control scheme.  Should the triggers roll you directly?  Should they be mapped to angle of attack of left and right wings?  Should they be mapped to give an aileron effect (left wing down, right wing up)?  How do you pitch?  You need a tail.  Ditto for yaw. 

In Topic: Whats a good mathematical model for heat transfer?

16 May 2014 - 06:51 AM

Start by thinking about it as heat energy, not as temperature.

You can get temperature from the internal energy by having the mass and thermal heat capacity of the objects.

The difference in temperature drives a flow of heat energy between the objects.

A thermal resistance slows this flow.


It works like Ohms law.  (E=IR)

But with thermal-ness it would be (T = QR)

where T is temperature delta, Q is heat flow, R is thermal resistance.


How you calculate R is the crux of how complicated your system is!  For a simple "looks good enough" you can just base it on surface area of the objects in contact with a scaling factor. 

For a more accurate effect, you'd have to deal with things like arriving at a convection coefficient which is brilliantly convoluted to calculate.  For round objects there are some natural logs that show up in the calculation of R.  There are Nussault numbers and Prandl numbers.  You can go nuts here.


Your specific example of heat transfer from oil->water is an example of a heat exchanger.


If you can be more specific about what you need to accomplish, we can advise you better.