Forum > C# > emmiters blend, plist, anchor and others

emmiters blend, plist, anchor and others

By camelot Posted 2012-03-15 21:47 Comments 14
camelot
  • Posts: 37

PROBLEM #1: plist

I exported plist from Particle Designer. That file contains

with that line visaul studio throw exception

System.NotSupportedException was unhandled
  Message=NotSupportedException
  StackTrace:
       at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlTextReaderImpl.Read()
       at cocos2d.CCSAXParser.parse(String pszFile)
       at cocos2d.CCDictMaker.dictionaryWithContentsOfFile(String pFileName)
       at cocos2d.CCFileUtils.dictionaryWithContentsOfFile(String pFileName)
       at cocos2d.CCParticleSystem.initWithFile(String plistFile)
       at Rebellion.GUI.GameLogo.createFlameEmiiter(Int32 depth)
       at Rebellion.GUI.GameLogo..ctor()
       at Rebellion.GUI.MainMenu.init()
       at Rebellion.GUI.MainMenu.node()
       at Rebellion.GUI.MainMenu.scene()
       at Rebellion.AERGameDelegate.applicationDidFinishLaunching()
       at cocos2d.CCApplication.LoadContent()
       at Microsoft.Xna.Framework.DrawableGameComponent.Initialize()
       at cocos2d.CCApplication.Initialize()
       at Microsoft.Xna.Framework.Game.Initialize()
       at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
       at Microsoft.Xna.Framework.Game.StartGameLoop()
       at Microsoft.Xna.Framework.XnaGameApplication.XnaGameApplicationStartGameLoop()
       at Microsoft.Xna.Framework.XnaGameApplication.XnaGameApplication_Launching(Object sender, LaunchingEventArgs e)
       at Microsoft.Phone.Shell.PhoneApplicationService.FireLaunching()
       at Microsoft.Phone.Execution.NativeEmInterop.FireOnLaunching()

without that file - everything is ok

camelot
  • Posts: 37

#1 RE: 2012-03-15 22:09

PROBLEM #2: emmiter blend

plist contains blending setting (additive blend)

plist

blendFuncDestination
1
blendFuncSource
770

C#

CCParticleSystemQuad flameEmmiter = new CCParticleSystemQuad();
flameEmmiter.initWithFile("flame");
addChild(flameEmmiter, depth);

also BlendFunc doesnt work

flameEmmiter.BlendFunc.src = OGLES.GL_SRC_ALPHA; //also tryed OGLES.GL_ONE
flameEmmiter.BlendFunc.dst = OGLES.GL_ONE;

works only “IsBlendAdditive”, but its lead to problem #3

C#

flameEmmiter.IsBlendAdditive = true;
camelot
  • Posts: 37

#2 RE: 2012-03-15 22:10

PROBLEM #3: IsBlendAdditive

if set emmiter.IsBlendAdditive = true , this makes all other sprites with higher depth become blend additive too.

here screenshot

C#

spriteRebellion = CCSprite.spriteWithFile(AERLocale.IMAGES_FOLDER + AssetID.IMAGE_REBELLION);
addChild(spriteRebellion, 1);

CCParticleSystemQuad flameEmmiter = new CCParticleSystemQuad();
flameEmmiter.initWithFile("flame");
flameEmmiter.IsBlendAdditive = true; // this makes "spriteRebellion" additive too
addChild(flameEmmiter, 0);
camelot
  • Posts: 37

#3 RE: 2012-03-15 22:13

PROBLEM #4: something wrong with particles anchor point

on windows phone emulator sprites spread and rotate looks like anchor point not in center

here screenshot

rotationEnd
0.0
rotationEndVariance
90
rotationStart
0.0
rotationStartVariance
90

if i change rotationEndVariance and rotationStartVariance to 0 - flame become like in Particle Designer but without rotates

camelot
  • Posts: 37

#4 RE: 2012-03-15 22:15

here plist and texture for tests

back_flame.plist (2.6 kB)

camelot
  • Posts: 37

#5 RE: 2012-03-15 22:15

texture

smoke5.png (6.3 kB)

camelot
  • Posts: 37

#6 RE: 2012-03-20 19:10

up

camelot
  • Posts: 37

#7 RE: 2012-03-27 20:52

bump again.
is there any developers read this forum?

Logan
  • Posts: 88

#8 RE: 2012-03-28 05:25

hi,
It seems this forum is not updated well. well anyway Which XML reader are you using to read the plist file? I believe that error is caused because .net’s XML readers cannot recognize the header since plist is a Mac specific XML file. removing the header should make it work fine. In case you want to make it work as it is you could try writing a custom XML parser.

Logan
  • Posts: 88

#9 RE: 2012-03-28 05:41

As for your third question I believe it is because the underlying XNA processes all sprites in batches. drawing everything in a single class might be the reason for your problem. cocos might me sending all sprites in a class to a single spritebatch draw method of XNA - Again I’m not sure this is how it goes in cocos. Dev’s might be of help here but it seems to be the right cause for your problem according to me. try using separate classes or layers for particles and Text.

sorry not so sure about your other two questions.

camelot
  • Posts: 37

#10 RE: 2012-04-07 19:55

seems like all developers abandon this project

jiangzhuo
  • Posts: 1

#11 RE: 2012-04-11 06:47

I have the seem problem4.
My solution is modifying plist file……

huangrh
  • Posts: 171

#12 RE: 2012-04-12 06:19

About problem 3, this is a bug, the blendadditive attribute shouldn’t affect other sprites.

huangrh
  • Posts: 171

#13 RE: 2012-04-12 06:43

The blendadditive bug has been fixed and committed,

About problem 4, the particle rotation wasn’t implemented before, now it acts,
you could try the latest code on the github.

Thank Evgeniy and Jiang for your reports.:)

swap
  • Posts: 28

#14 RE: 2012-04-25 11:15

About the problem #1… I solved it this way:

...
XmlReaderSettings settings = new XmlReaderSettings();
settings.DtdProcessing = DtdProcessing.Ignore;
XmlReader xmlReader = XmlReader.Create(textReader, settings);
...

directly in CCSAXParser class. There is no reason to read DTD.

Jiri Formanek
Mingle Games
http://www.facebook.com/pages/Mingle-Games/122532511173330

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps