issues in parallel... So this commit contains: an update of the solver (e.g. moving objects), integration of blender IPOs, improved rendering (motion blur, smoothed normals) and a first particle test. In more detail: Solver update: - Moving objects using a relatively simple model, and not yet fully optimized - ok for box falling into water, water in a moving glass might cause trouble. Simulation times are influenced by overall no. of triangles of the mesh, scaling meshes up a lot might also cause slowdowns. - Additional obstacle settings: noslip (as before), free slip (move along wall freely) and part slip (mix of both). - Obstacle settings also added for domain boundaries now, the six walls of the domain are obstacles after all as well - Got rid of templates, should make compiling for e.g. macs more convenient, for linux there's not much difference. Finally got rid of parser (and some other code parts), the simulation now uses the internal API to transfer data. - Some unnecessary file were removed, the GUI now needs 3 settings buttons... This should still be changed (maybe by adding a new panel for domain objects). IPOs: - Animated params: viscosity, time and gravity for domains. In contrast to normal time IPO for Blender objects, the fluidsim one scales the time step size - so a constant 1 has no effect, values towards 0 slow it down, larger ones speed the simulation up (-> longer time steps, more compuations). The viscosity IPO is also only a factor for the selected viscosity (again, 1=no effect). - For objects that are enabled for fluidsim, a new IPO type shows up. Inflow objects can use the velocity channels to animate the inflow. Obstacles, in/outflow objects can be switched on (Active IPO>0) and off (<0) during the simulation. - Movement, rotation and scaling of those 3 types is exported from the normal Blender channels (Loc,dLoc,etc.). Particles: - This is still experimental, so it might be deactivated for a release... It should at some point be used to model smaller splashes, depending on the the realworld size and the particle generation settings particles are generated during simulation (stored in _particles_X.gz files). - These are loaded by enabling the particle field for an arbitrary object, which should be given a halo material. For each frame, similar to the mesh loading, the particle system them loads the simulated particle positions. - For rendering, I "abused" the part->rt field - I couldnt find any use for it in the code and it seems to work fine. The fluidsim particles store their size there. Rendering: - The fluidims particles use scaled sizes and alpha values to give a more varied appearance. In convertblender.c fluidsim particle systems use the p->rt field to scale up the size and down the alpha of "smaller particles". Setting the influence fields in the fluidims settings to 0 gives equally sized particles with same alpha everywhere. Higher values cause larger differences. - Smoothed normals: for unmodified fluid meshes (e.g. no subdivision) the normals computed by the solver are used. This is basically done by switching off the normal recalculation in convertblender.c (the function calc_fluidsimnormals handles other mesh inits instead of calc_vertexnormals). This could also be used to e.g. modify mesh normals in a modifier... - Another change is that fluidsim meshes load the velocities computed during the simulation for image based motion blur. This is inited in load_fluidsimspeedvectors for the vector pass (they're loaded during the normal load in DerivedMesh readBobjgz). Generation and loading can be switched off in the settings. Vector pass currently loads the fluidism meshes 3 times, so this should still be optimized. Examples: - smoothed normals versus normals from subdividing once: http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_1smoothnorms.png http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_2subdivnorms.png - fluidsim particles, size/alpha influence 0: http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_3particlesnorm.png size influence 1: http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_4particlessize.png size & alpha influence 1: http://www10.informatik.uni-erlangen.de/~sinithue/temp/v060227_5particlesalpha.png - the standard drop with motion blur and particles: http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t2new.mpg (here's how it looks without http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t1old.mpg) - another inflow animation (moving, switched on/off) with a moving obstacle (and strong mblur :) http://www10.informatik.uni-erlangen.de/~sinithue/temp/elbeemupdate_t3ipos.mpg Things still to fix: - rotating & scaling domains causes wrong speed vectors - get rid of SDL code for threading, use pthreads as well? - update wiki documentation - cool effects for rendering would be photon maps for caustics, and motion blur for particles :)
164 lines
4.5 KiB
C
164 lines
4.5 KiB
C
/**
|
|
* blenlib/DNA_ID.h (mar-2001 nzc)
|
|
*
|
|
* ID and Library types, which are fundamental for sdna,
|
|
*
|
|
* $Id$
|
|
*
|
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version. The Blender
|
|
* Foundation also sells licenses for use in proprietary software under
|
|
* the Blender License. See http://www.blender.org/BL/ for information
|
|
* about this.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
* All rights reserved.
|
|
*
|
|
* The Original Code is: all of this file.
|
|
*
|
|
* Contributor(s): none yet.
|
|
*
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
*/
|
|
#ifndef DNA_ID_H
|
|
#define DNA_ID_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* There's a nasty circular dependency here.... void* to the rescue! I
|
|
* really wonder why this is needed. */
|
|
|
|
struct Library;
|
|
struct FileData;
|
|
|
|
/* watch it: Sequence has identical beginning. */
|
|
/**
|
|
* ID is the first thing included in all serializable types. It
|
|
* provides a common handle to place all data in double-linked lists.
|
|
* */
|
|
typedef struct ID {
|
|
void *next, *prev;
|
|
struct ID *newid;
|
|
struct Library *lib;
|
|
char name[24];
|
|
short us;
|
|
/**
|
|
* LIB_... flags report on status of the datablock this ID belongs
|
|
* to.
|
|
*/
|
|
short flag;
|
|
int icon_id;
|
|
} ID;
|
|
|
|
/**
|
|
* For each library file used, a Library struct is added to Main
|
|
*/
|
|
typedef struct Library {
|
|
ID id;
|
|
ID *idblock;
|
|
struct FileData *filedata;
|
|
char name[240]; /* reveiled in the UI, can store relative path */
|
|
char filename[240]; /* expanded name, not relative, used while reading */
|
|
int tot, pad; /* tot, idblock and filedata are only fo read and write */
|
|
} Library;
|
|
|
|
/**
|
|
* Defines for working with IDs.
|
|
*
|
|
* The tags represent types! This is a dirty way of enabling RTTI. The
|
|
* sig_byte end endian defines aren't really used much.
|
|
*
|
|
**/
|
|
|
|
#if defined(__sgi) || defined(__sparc) || defined(__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__)
|
|
/* big endian */
|
|
#define MAKE_ID2(c, d) ( (c)<<8 | (d) )
|
|
#define MOST_SIG_BYTE 0
|
|
#define BBIG_ENDIAN
|
|
#else
|
|
/* little endian */
|
|
#define MAKE_ID2(c, d) ( (d)<<8 | (c) )
|
|
#define MOST_SIG_BYTE 1
|
|
#define BLITTLE_ENDIAN
|
|
#endif
|
|
|
|
/* ID */
|
|
#define ID_SCE MAKE_ID2('S', 'C')
|
|
#define ID_LI MAKE_ID2('L', 'I')
|
|
#define ID_OB MAKE_ID2('O', 'B')
|
|
#define ID_ME MAKE_ID2('M', 'E')
|
|
#define ID_CU MAKE_ID2('C', 'U')
|
|
#define ID_MB MAKE_ID2('M', 'B')
|
|
#define ID_MA MAKE_ID2('M', 'A')
|
|
#define ID_TE MAKE_ID2('T', 'E')
|
|
#define ID_IM MAKE_ID2('I', 'M')
|
|
#define ID_IK MAKE_ID2('I', 'K')
|
|
#define ID_WV MAKE_ID2('W', 'V')
|
|
#define ID_LT MAKE_ID2('L', 'T')
|
|
#define ID_SE MAKE_ID2('S', 'E')
|
|
#define ID_LF MAKE_ID2('L', 'F')
|
|
#define ID_LA MAKE_ID2('L', 'A')
|
|
#define ID_CA MAKE_ID2('C', 'A')
|
|
#define ID_IP MAKE_ID2('I', 'P')
|
|
#define ID_KE MAKE_ID2('K', 'E')
|
|
#define ID_WO MAKE_ID2('W', 'O')
|
|
#define ID_SCR MAKE_ID2('S', 'R')
|
|
#define ID_VF MAKE_ID2('V', 'F')
|
|
#define ID_TXT MAKE_ID2('T', 'X')
|
|
#define ID_SO MAKE_ID2('S', 'O')
|
|
#define ID_SAMPLE MAKE_ID2('S', 'A')
|
|
#define ID_GR MAKE_ID2('G', 'R')
|
|
#define ID_ID MAKE_ID2('I', 'D')
|
|
#define ID_AR MAKE_ID2('A', 'R')
|
|
#define ID_AC MAKE_ID2('A', 'C')
|
|
#define ID_SCRIPT MAKE_ID2('P', 'Y')
|
|
#define ID_FLUIDSIM MAKE_ID2('F', 'S')
|
|
#define ID_NT MAKE_ID2('N', 'T')
|
|
|
|
/* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
|
|
#define ID_SEQ MAKE_ID2('S', 'Q')
|
|
/* constraint */
|
|
#define ID_CO MAKE_ID2('C', 'O')
|
|
/* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */
|
|
#define ID_PO MAKE_ID2('A', 'C')
|
|
/* used in outliner... */
|
|
#define ID_NLA MAKE_ID2('N', 'L')
|
|
|
|
|
|
/* id->flag: set frist 8 bits always at zero while reading */
|
|
#define LIB_LOCAL 0
|
|
#define LIB_EXTERN 1
|
|
#define LIB_INDIRECT 2
|
|
#define LIB_TEST 8
|
|
#define LIB_TESTEXT 9
|
|
#define LIB_TESTIND 10
|
|
#define LIB_READ 16
|
|
#define LIB_NEEDLINK 32
|
|
|
|
#define LIB_NEW 256
|
|
#define LIB_FAKEUSER 512
|
|
/* free test flag */
|
|
#define LIB_DOIT 1024
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|