当前位置:网站首页>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 ;
边栏推荐
- 绕过 Web 应用程序中的 XSS 过滤器
- Luogu p4281 [ahoi2008] emergency gathering / gathering solution
- epoll的实现原理
- How to publish your own NPM package
- Now the operator wants to check the answer details of all user questions from Zhejiang University. Please take out the corresponding data
- [live review] AI customer service "changes according to the situation", and man-machine dialogue can be easier
- How to get the database creation time?
- Your technical leader doesn't understand this? Without it, there is no complete thinking process of design
- Anaconda installs jupyter
- Three must know and know problems of redis
猜你喜欢

Interviewer: explain the core principle of ThreadLocal

"Niuke | daily question" inverse Polish expression

Druid connection pool - strong self-study from 0. Those who don't understand Druid can click in. If you know not to click in, you will think I'm wordy
![[literature notes] pointmlp](/img/8f/654dc6e2f4770b7f12aab49098d3d7.png)
[literature notes] pointmlp

Your technical leader doesn't understand this? Without it, there is no complete thinking process of design

Why does the official not recommend using UUID as MySQL primary key

Ffmpeg download and installation

When we talk about immutable infrastructure, what are we talking about
![[analysis of GPIO register (crl/crh) configuration of STM32]](/img/63/a7b262e95f1dc74201ace9d411b46f.png)
[analysis of GPIO register (crl/crh) configuration of STM32]

Teach you three ways to optimize the performance from 20s to 500ms
随机推荐
Three must know and know problems of redis
How can test / development programmers with 5 years of experience break through the technical bottleneck? Common problems in big factories
Dragon Dragon community released the first Anolis OS Security Guide to escort users' business systems
Gbase JDBC connection database exception
Luogu p4281 [ahoi2008] emergency gathering / gathering solution
nacos中哪边有这个列的sql脚本啊?
[c language] custom type (structure ~ enumeration ~ Union)
教你三招从让性能从20s优化到500ms
Implementation of recommendation system collaborative filtering in spark
Teach you how to locate unreasonable SQL? And optimize it
300. Longest increasing subsequence
Sword finger offer II 012. the sum of the left and right subarrays is equal
Seven suggestions for Server Protection
HMS core discovery Episode 16 live broadcast preview | play AI's new "sound" state with tiger pier
DOM在Ahooks中的处理过程
STM32 Development Notes 119: what macros are required to enable FPU?
[wechat applet] picker scroll selector (85/100)
Baklib: share some methods about building enterprise knowledge management (km)
Set up private CA server
The 6th "Blue Hat Cup" National College Students' Cyber Security Skills Competition writeup