基于体渲染的OpenGL烟雾模拟程序,效率需要提高,烟雾纹理需要改进,有兴趣的朋友可以参考下!
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 545 2001-10-02 01:15 Smoke_shaderglutsnowman.dsw
文件 489 2001-10-17 23:18 Smoke_shaderfonts.h
文件 419 2001-11-11 04:11 Smoke_shaderl3DBillboard.h
文件 1536 2001-09-27 23:59 Smoke_shadermaths.h
文件 8661 2001-01-02 23:32 Smoke_shader ga.cpp
文件 827 2000-12-03 00:00 Smoke_shader ga.h
文件 262683 2000-04-02 00:45 Smoke_shader ree.tga
文件 1864 2008-11-14 15:40 Smoke_shaderShaderUtil.h
文件 173056 2008-12-02 16:29 Smoke_shaderglutsnowman.ncb
文件 1784 2008-12-01 16:06 Smoke_shaderglutsnowman.plg
文件 79898 1998-08-18 23:25 Smoke_shaderglut32.lib
文件 169984 1998-08-18 23:25 Smoke_shaderglut32.dll
文件 7105 2008-11-14 15:59 Smoke_shaderillboard.cpp
文件 5176 2002-05-13 15:33 Smoke_shaderspark.bmp
文件 5176 2002-05-15 16:17 Smoke_shaderubble.bmp
文件 5176 2002-05-15 16:17 Smoke_shadercloud.bmp
文件 2069 2008-11-14 15:35 Smoke_shaderfonts.cpp
文件 196664 2008-11-14 15:12 Smoke_shadercolorGradient.bmp
文件 192512 2006-03-04 03:19 Smoke_shaderglew32.dll
文件 281360 2006-03-04 03:19 Smoke_shaderglew32.lib
文件 7871 2008-11-14 15:35 Smoke_shaderl3dBillboard.cpp
文件 81920 2008-11-19 16:07 Smoke_shaderglutsnowman.exe
文件 8337 2008-11-14 15:40 Smoke_shaderShaderUtil.cpp
文件 266 2008-11-14 17:19 Smoke_shaderParticleUtils.cpp
文件 150 2008-11-14 17:19 Smoke_shaderParticleUtils.h
文件 2310 2008-11-14 13:45 Smoke_shaderpVector.h
文件 4226 2008-11-18 10:50 Smoke_shaderglutsnowman.dsp
文件 384 2008-11-18 10:45 Smoke_shadershaderVolumeParticle.vert
文件 169984 1998-08-18 23:25 Smoke_shadershaderglut32.dll
文件 192512 2006-03-04 03:19 Smoke_shadershaderglew32.dll
............此处省略49个文件信息
#include
#include “glglut.h“
#include
#include “maths.h“
/*-----------------------------------------------------------------
The objects motion is restricted to a rotation on a predefined axis
The function bellow does cylindrical billboarding on the Y axis i.e.
the object will be able to rotate on the Y axis only.
-----------------------------------------------------------------*/
void l3dBillboardLocalToWorld(float *cam float *worldPos) {
float modelview[16];
glGetFloatv(GL_MODELVIEW_MATRIX modelview);
// The local origin‘s position in world coordinates
worldPos[0] = cam[0] + modelview[12]*modelview[0] + modelview[13] * modelview[1] + modelview[14] * modelview[2];
worldPos[1] = cam[1] + modelview[12]*modelview[4] + modelview[13] * modelview[5] + modelview[14] * modelview[6];
worldPos[2] = cam[2] + modelview[12]*modelview[8] + modelview[13] * modelview[9] + modelview[14] * modelview[10];
}
/*-----------------------------------------------------------------
The objects motion is restricted to a rotation on a predefined axis
The function bellow does cylindrical billboarding on the Y axis i.e.
the object will be able to rotate on the Y axis only.
-----------------------------------------------------------------*/
void l3dBillboardCylindricalBegin(float *cam float *worldPos) {
float lookAt[3]={001}objToCamProj[3]upAux[3]angleCosine;
// objToCamProj is the vector in world coordinates from the local origin to the camera
// projected in the XZ plane
objToCamProj[0] = cam[0] - worldPos[0] ;
objToCamProj[1] = 0;
objToCamProj[2] = cam[2] - worldPos[2] ;
// normalize both vectors to get the cosine directly afterwards
mathsNormalize(objToCamProj);
// easy fix to determine wether the angle is negative or positive
// for positive angles upAux will be a vector pointing in the
// positive y direction otherwise upAux will point downwards
// effectively reversing the rotation.
mathsCrossProduct(upAuxlookAtobjToCamProj);
// compute the angle
angleCosine = mathsInnerProduct(lookAtobjToCamProj);
// perform the rotation. The if statement is used for stability reasons
// if the lookAt and v vectors are too close together then |aux| could
// be bigger than 1 due to lack of precision
if ((angleCosine < 0.99990) && (angleCosine > -0.9999))
glRotatef(acos(angleCosine)*180/3.14upAux[0] upAux[1] upAux[2]);
}
/*----------------------------------------------------------------
True billboarding. With the spherical version the object will
always face the camera. It requires more computational effort than
the cylindrical billboard though. The parameters camXcamY and camZ
are the target i.e. a 3D point to which the object will point.
----------------------------------------------------------------*/
void l3dBillboardSphericalBegin(float *cam float *worldPos) {
float lookAt[3]={001}objToCamProj[3]objToCam[3]upAux[3]angleCosi
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 545 2001-10-02 01:15 Smoke_shaderglutsnowman.dsw
文件 489 2001-10-17 23:18 Smoke_shaderfonts.h
文件 419 2001-11-11 04:11 Smoke_shaderl3DBillboard.h
文件 1536 2001-09-27 23:59 Smoke_shadermaths.h
文件 8661 2001-01-02 23:32 Smoke_shader ga.cpp
文件 827 2000-12-03 00:00 Smoke_shader ga.h
文件 262683 2000-04-02 00:45 Smoke_shader ree.tga
文件 1864 2008-11-14 15:40 Smoke_shaderShaderUtil.h
文件 173056 2008-12-02 16:29 Smoke_shaderglutsnowman.ncb
文件 1784 2008-12-01 16:06 Smoke_shaderglutsnowman.plg
文件 79898 1998-08-18 23:25 Smoke_shaderglut32.lib
文件 169984 1998-08-18 23:25 Smoke_shaderglut32.dll
文件 7105 2008-11-14 15:59 Smoke_shaderillboard.cpp
文件 5176 2002-05-13 15:33 Smoke_shaderspark.bmp
文件 5176 2002-05-15 16:17 Smoke_shaderubble.bmp
文件 5176 2002-05-15 16:17 Smoke_shadercloud.bmp
文件 2069 2008-11-14 15:35 Smoke_shaderfonts.cpp
文件 196664 2008-11-14 15:12 Smoke_shadercolorGradient.bmp
文件 192512 2006-03-04 03:19 Smoke_shaderglew32.dll
文件 281360 2006-03-04 03:19 Smoke_shaderglew32.lib
文件 7871 2008-11-14 15:35 Smoke_shaderl3dBillboard.cpp
文件 81920 2008-11-19 16:07 Smoke_shaderglutsnowman.exe
文件 8337 2008-11-14 15:40 Smoke_shaderShaderUtil.cpp
文件 266 2008-11-14 17:19 Smoke_shaderParticleUtils.cpp
文件 150 2008-11-14 17:19 Smoke_shaderParticleUtils.h
文件 2310 2008-11-14 13:45 Smoke_shaderpVector.h
文件 4226 2008-11-18 10:50 Smoke_shaderglutsnowman.dsp
文件 384 2008-11-18 10:45 Smoke_shadershaderVolumeParticle.vert
文件 169984 1998-08-18 23:25 Smoke_shadershaderglut32.dll
文件 192512 2006-03-04 03:19 Smoke_shadershaderglew32.dll
............此处省略49个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)