资源简介

光滑流体粒子动力学(SPH)方法简单实例代码,包括可运行程序。 其中,图形绘制部分采用 DirectX 引擎。 具体分析过程,见博客:http://blog.csdn.net/ironyoung/article/details/8068929

资源截图

代码片段和文件信息

//--------------------------------------------------------------------------------------
// File: DXUT.cpp
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//--------------------------------------------------------------------------------------
#include “DXUT.h“
#define DXUT_MIN_WINDOW_SIZE_X 200
#define DXUT_MIN_WINDOW_SIZE_Y 200
#define DXUT_COUNTER_STAT_LENGTH 2048
#undef min // use __min instead inside this source file
#undef max // use __max instead inside this source file

#ifndef ARRAYSIZE
extern “C++“ // templates cannot be declared to have ‘C‘ linkage
template 
char (*RtlpNumberOf( UNALIGNED T (&)[N] ))[N];

#define RTL_NUMBER_OF_V2(A) (sizeof(*RtlpNumberOf(A)))
#define ARRAYSIZE(A)    RTL_NUMBER_OF_V2(A)
#endif

//--------------------------------------------------------------------------------------
// Thread safety
//--------------------------------------------------------------------------------------
CRITICAL_SECTION    g_cs;
bool                g_bThreadSafe = true;


//--------------------------------------------------------------------------------------
// Automatically enters & leaves the CS upon object creation/deletion
//--------------------------------------------------------------------------------------
class DXUTLock
{
public:
    inline  DXUTLock()
    {
        if( g_bThreadSafe ) EnterCriticalSection( &g_cs );
    }
    inline  ~DXUTLock()
    {
        if( g_bThreadSafe ) LeaveCriticalSection( &g_cs );
    }
};



//--------------------------------------------------------------------------------------
// Helper macros to build member functions that access member variables with thread safety
//--------------------------------------------------------------------------------------
#define SET_ACCESSOR( x y )       inline void Set##y( x t )   { DXUTLock l; m_state.m_##y = t; };
#define GET_ACCESSOR( x y )       inline x Get##y()           { DXUTLock l; return m_state.m_##y; };
#define GET_SET_ACCESSOR( x y )   SET_ACCESSOR( x y ) GET_ACCESSOR( x y )

#define SETP_ACCESSOR( x y )      inline void Set##y( x* t )  { DXUTLock l; m_state.m_##y = *t; };
#define GETP_ACCESSOR( x y )      inline x* Get##y()          { DXUTLock l; return &m_state.m_##y; };
#define GETP_SETP_ACCESSOR( x y ) SETP_ACCESSOR( x y ) GETP_ACCESSOR( x y )


//--------------------------------------------------------------------------------------
// Stores timer callback info
//--------------------------------------------------------------------------------------
struct DXUT_TIMER
{
    LPDXUTCALLBACKTIMER pCallbackTimer;
    void* pCallbackUserContext;
    float fTimeoutInSecs;
    float fCountdown;
    bool bEnabled;
    UINT nID;
};

//--------------------------------------------------------------------------------------
// D3D10 Counters
//--------------------------------------------------------------------------------------
struct D3D1

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-11-23 14:02  SPH\
     目录           0  2011-04-07 20:39  SPH\DXUT\
     目录           0  2011-04-07 20:46  SPH\DXUT\Core\
     文件         335  2009-09-02 16:39  SPH\DXUT\Core\dpiaware.manifest
     文件      290624  2009-09-02 16:39  SPH\DXUT\Core\DXUT.cpp
     文件       19380  2009-09-02 16:39  SPH\DXUT\Core\DXUT.h
     文件        1612  2009-09-02 16:39  SPH\DXUT\Core\DXUTCore_2005.sln
     文件        8227  2011-03-02 17:59  SPH\DXUT\Core\DXUTCore_2005.vcproj
     文件        1613  2009-09-02 16:39  SPH\DXUT\Core\DXUTCore_2008.sln
     文件        9419  2009-09-02 16:39  SPH\DXUT\Core\DXUTCore_2008.vcproj
     文件      165716  2009-09-02 16:39  SPH\DXUT\Core\DXUTenum.cpp
     文件       18686  2009-09-02 16:39  SPH\DXUT\Core\DXUTenum.h
     文件       75964  2009-09-02 16:39  SPH\DXUT\Core\DXUTmisc.cpp
     文件       25819  2009-09-02 16:39  SPH\DXUT\Core\DXUTmisc.h
     目录           0  2011-04-07 20:46  SPH\DXUT\Optional\
     文件       25214  2009-09-02 16:39  SPH\DXUT\Optional\directx.ico
     文件       57410  2009-09-02 16:39  SPH\DXUT\Optional\DXUTcamera.cpp
     文件       18252  2009-09-02 16:39  SPH\DXUT\Optional\DXUTcamera.h
     文件      227414  2009-09-02 16:39  SPH\DXUT\Optional\DXUTgui.cpp
     文件       45635  2009-09-02 16:39  SPH\DXUT\Optional\DXUTgui.h
     文件       37345  2009-09-02 16:39  SPH\DXUT\Optional\DXUTguiIME.cpp
     文件        5886  2009-09-02 16:39  SPH\DXUT\Optional\DXUTguiIME.h
     文件        9763  2009-09-02 16:39  SPH\DXUT\Optional\DXUTLockFreePipe.h
     文件        1620  2009-09-02 16:39  SPH\DXUT\Optional\DXUTOptional_2005.sln
     文件        9602  2011-03-02 17:59  SPH\DXUT\Optional\DXUTOptional_2005.vcproj
     文件        1621  2009-09-02 16:39  SPH\DXUT\Optional\DXUTOptional_2008.sln
     文件       10892  2009-09-02 16:39  SPH\DXUT\Optional\DXUTOptional_2008.vcproj
     文件      845866  2009-09-02 16:39  SPH\DXUT\Optional\DXUTres.cpp
     文件         869  2009-09-02 16:39  SPH\DXUT\Optional\DXUTres.h
     文件      115930  2009-09-02 16:39  SPH\DXUT\Optional\DXUTsettingsdlg.cpp
     文件       10664  2009-09-02 16:39  SPH\DXUT\Optional\DXUTsettingsdlg.h
............此处省略41个文件信息

评论

共有 条评论