当前位置:网站首页>Preliminary understanding of Panda3D particle system
Preliminary understanding of Panda3D particle system
2022-07-25 05:07:00 【bcbobo21cn】
function panda3d Example Tut-Particle-Panel.py; A basic particle system appears as follows ;

At the same time, the particle system panel appears as follows ;
The programming principle of particle system should be to specify the emission position of particles 、 Number 、 Particle size 、 Color and other parameters , Then the engine makes it ;
Adjust the panel parameters , Basically no effect was found ;
I studied it , Its particle system configuration is *.ptf file ; Load different ptf file , Take a look at the effect ;
wait ;
Open one ptf Take a look at the document ; Is the plain text , It can be edited manually ; An example is as follows ;
self.reset()
self.setPos(0.000, 0.000, 0.000)
self.setHpr(0.000, 0.000, 0.000)
self.setScale(1.000, 1.000, 1.000)
p0 = Particles.Particles('particles-1')
# Particles parameters
p0.setFactory("PointParticleFactory")
p0.setRenderer("PointParticleRenderer")
p0.setEmitter("DiscEmitter")
p0.setPoolSize(10000)
p0.setBirthRate(0.0200)
p0.setLitterSize(300)
p0.setLitterSpread(100)
p0.setSystemLifespan(0.0000)
p0.setLocalVelocityFlag(1)
p0.setSystemGrowsOlderFlag(0)
# Factory parameters
p0.factory.setLifespanBase(0.5000)
p0.factory.setLifespanSpread(0.2500)
p0.factory.setMassBase(2.0000)
p0.factory.setMassSpread(0.0100)
p0.factory.setTerminalVelocityBase(400.0000)
p0.factory.setTerminalVelocitySpread(0.0000)
# Point factory parameters
# Renderer parameters
p0.renderer.setAlphaMode(BaseParticleRenderer.PRALPHAOUT)
p0.renderer.setUserAlpha(0.45)
# Point parameters
p0.renderer.setPointSize(3.00)
p0.renderer.setStartColor(Vec4(0.25, 0.90, 1.00, 1.00))
p0.renderer.setEndColor(Vec4(1.00, 1.00, 1.00, 1.00))
p0.renderer.setBlendType(PointParticleRenderer.PPONECOLOR)
p0.renderer.setBlendMethod(BaseParticleRenderer.PPNOBLEND)
# Emitter parameters
p0.emitter.setEmissionType(BaseParticleEmitter.ETCUSTOM)
p0.emitter.setAmplitude(1.0000)
p0.emitter.setAmplitudeSpread(0.0000)
p0.emitter.setOffsetForce(Vec3(0.0000, 0.0000, 4.0000))
p0.emitter.setExplicitLaunchVector(Vec3(1.0000, 0.0000, 0.0000))
p0.emitter.setRadiateOrigin(Point3(0.0000, 0.0000, 0.0000))
# Disc parameters
p0.emitter.setRadius(0.0500)
p0.emitter.setOuterAngle(356.1859)
p0.emitter.setInnerAngle(0.0000)
p0.emitter.setOuterMagnitude(2.0000)
p0.emitter.setInnerMagnitude(1.0000)
p0.emitter.setCubicLerping(0)
self.addParticles(p0)
f0 = ForceGroup.ForceGroup('gravity')
# Force parameters
force0 = LinearVectorForce(Vec3(0.0000, 0.0000, -1.0000), 25.0000, 1)
force0.setActive(1)
f0.addForce(force0)
force1 = LinearJitterForce(3.0000, 1)
force1.setActive(1)
f0.addForce(force1)
self.addForceGroup(f0)Display the... Of the particle system panel python The code is as follows ;
import sys
import direct.directbase.DirectStart
base.startTk()
from direct.tkpanels.ParticlePanel import ParticlePanel
pp = ParticlePanel() # Create the panel
base.disableMouse() # Disable camera control to place it
camera.setY(-10) # Place the camera
base.setBackgroundColor(0, 0, 0) # Most particle systems show up better on black backgrounds
run() Particle systems are usually superimposed on the model to make some effects , For example, simulate building fire ;
BaseParticleRenderer Is the base class of particle system ;
The categories of particle systems include : Geometric particles , Line segment particle , Point particles , Pyrotechnic particles , spirit ;
classBaseParticleRenderer
Bases:
Bases: ReferenceCount
Pure virtual particle renderer base class
This class is a pure virtual class ; When programming, use derived concrete classes ;
边栏推荐
- Completed project series Tutorials - smart campus management system
- Implementation principle of epoll
- 服务器防护的七个建议
- Get the parameters of the browser address bar
- Special analysis of data security construction in banking industry
- Three must know and know problems of redis
- rhcsa暑假第二天
- Openworm project compilation
- 使用getifaddrs获取本机网口IP地址
- [untitled]
猜你喜欢

Redis集群搭建(Windows)

The second day of rhcsa summer vacation

Execution process of NPM run XX

Pychart configuration pyqt5

小红书携手HMS Core,畅玩高清视界,种草美好生活

Small case of data analysis: visualize recruitment data and view the most needed technologies in the field~
![[wechat applet] design and interactive implementation of auction product details page (including countdown and real-time update of bids)](/img/01/42de6280191b9c32a7f37d7727bd4f.png)
[wechat applet] design and interactive implementation of auction product details page (including countdown and real-time update of bids)

Basic knowledge of scratch crawler framework

85 distributed project construction

How can test / development programmers with 5 years of experience break through the technical bottleneck? Common problems in big factories
随机推荐
Gradle test and idea test
Luogu p2391 snow covered problem solution
Render Optimization: repaint and reflow
STM32 development note 120: solve the problem that%f in printf cannot be output
How to merge cells in a table by markdown
Set up private CA server
Deep understanding of pod
Valley p2420 let's XOR solution
STM32 development note 117: generate IIR low-pass filter coefficients using MATLAB
[the most comprehensive and detailed] how to design a database and table splitting scheme that can dynamically expand and shrink capacity?
harbor安装
The third question of force deduction -- the longest substring without repeated characters
Redis集群搭建(Windows)
Etcd learning
Solve the problem that uni app applet obtains routes and route parameters
[untitled]
nacos中哪边有这个列的sql脚本啊?
unity 3D物体添加 点击事件
AUTOSAR from getting started to mastering 100 lectures (105) - protection mechanism of AUTOSAR timing for functional safety
STM32 Development Notes 121: Kalman filter I understand