HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  

Share | 
 

 Does spark work with Irrlicht 1.8?

View previous topic View next topic Go down 
Go to page : Previous  1, 2, 3, 4, 5, 6  Next
AuthorMessage
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 6:24 am

well mines way in the sky or above the character
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 6:30 am

I am testing it further, will keep you informed.

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 6:35 am

yo gonna up load the original model standby
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 6:39 am

http://www.mediafire.com/download/pmkqjazehy5ivhg/grunt.X

you have to download his base textures which I provided so get them or just link you model to some other image won't really matter.
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 6:57 am

Ah, just re-read your code, in fact you're not attaching the system to the joint, you're just setting its position to the position of the joint. That's normal that the position is not updated afterwards.

I did not found any bugs, instead everythings seems to work as expected. Here is my code:

Code:

//////////////////////////////////////////////////////////////////////////////////
// SPARK Irrlicht Rendering library //
// Copyright (C) 2008-2013 //
// Julien Fryer - julienfryer@gmail.com //
// Thibault Lescoat -  info-tibo <at> orange <dot> fr //
// //
// //
// This software is provided 'as-is', without any express or implied //
// warranty.  In no event will the authors be held liable for any damages //
// arising from the use of this software. //
// //
// Permission is granted to anyone to use this software for any purpose, //
// including commercial applications, and to alter it and redistribute it //
// freely, subject to the following restrictions: //
// //
// 1. The origin of this software must not be misrepresented; you must not //
//    claim that you wrote the original software. If you use this software //
//    in a product, an acknowledgment in the product documentation would be //
//    appreciated but is not required. //
// 2. Altered source versions must be plainly marked as such, and must not be //
//    misrepresented as being the original software. //
// 3. This notice may not be removed or altered from any source distribution. //
//////////////////////////////////////////////////////////////////////////////////

// external libs
#include <irrlicht.h>

// SPARK lib
#include <SPARK.h>
#include <SPARK_IRR.h>


using namespace irr;
using namespace std;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
IrrlichtDevice* device = NULL;

// Input Receiver
class MyEventReceiver : public IEventReceiver
{
 public:
 virtual bool OnEvent(const SEvent& event)
 {
 if(event.EventType==EET_KEY_INPUT_EVENT)
 {
 if(event.KeyInput.Key == KEY_ESCAPE && event.KeyInput.PressedDown==false)
 {
 device->closeDevice();
 }
 }
 return false;
 }

 int oldMouseX,oldMouseY;
};


SPK::Ref<SPK::System> createMagicSystem(irr::IrrlichtDevice* device, bool reverse)
{
 const float scale = 40.0f;
 SPK::Ref<SPK::System> system = SPK::System::create();
 
SPK::Ref<SPK::IRR::IRRQuadRenderer> quadRenderer = SPK::IRR::IRRQuadRenderer::create(device);
 quadRenderer->setBlendMode(SPK::BLEND_MODE_ADD);
 quadRenderer->enableRenderingOption(SPK::RENDERING_OPTION_DEPTH_WRITE, false);
 quadRenderer->setTexture(device->getVideoDriver()->getTexture("res\\flare.bmp"));
 quadRenderer->setTexturingMode(SPK::TEXTURE_MODE_2D);

 SPK::Ref<SPK::RandomEmitter> emitter = SPK::RandomEmitter::create(SPK::Point::create());
 emitter->setForce(0.4f * scale, 0.6f * scale);
 emitter->setFlow(200);

 SPK::Ref<SPK::ColorGraphInterpolator> graphInterpolator = SPK::ColorGraphInterpolator::create();
 graphInterpolator->addEntry(reverse ? 1.0f : 0.0f, 0xFF000088);
 graphInterpolator->addEntry(0.5f, 0x00FF0088);
 graphInterpolator->addEntry(reverse ? 0.0f : 1.0f, 0x0000FF88);

 SPK::Ref<SPK::Group> group = system->createGroup(400);
 group->setRadius(0.15f);
 group->setLifeTime(1.0f, 2.0f);
 group->setColorInterpolator(graphInterpolator);
 group->setParamInterpolator(SPK::PARAM_SCALE, SPK::FloatRandomInterpolator::create(0.8f * scale, 1.2f * scale, 0.0f, 0.0f));
 group->setParamInterpolator(SPK::PARAM_ANGLE, SPK::FloatRandomInitializer::create(0.0f, 2 * 3.14159f));
 group->addEmitter(emitter);
 group->addModifier(SPK::Gravity::create(SPK::Vector3D(0.0f, -0.5f, 0.0f)));
 group->addModifier(SPK::Friction::create(0.2f));
 group->setRenderer(quadRenderer);

 return system;
}

// Main function
int main(int argc, char *argv[])
{
 //!IRRLICHT
 video::E_DRIVER_TYPE chosenDriver = video::EDT_OPENGL;

 //!IRRLICHT
 device = createDevice(chosenDriver,
 core::dimension2d<u32>(1600, 900),
 32,
 false,
 false,
 false,
 new MyEventReceiver);

 video::IVideoDriver* driver = device->getVideoDriver();
 scene::ISceneManager* smgr = device->getSceneManager();
 gui::IGUIEnvironment* guienv = device->getGUIEnvironment();

 device->setWindowCaption(L"SPARK Irrlicht test - Attaching to joint");
 device->getCursorControl()->setVisible(false);


 // add camera
 scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
 device->getCursorControl()->setVisible(false);
 camera->setNearValue(0.1f);
 camera->setFarValue(999999.0f);
 camera->setFOV(70);

 scene::IAnimatedMesh* mesh = smgr->getMesh("media//dwarf.x");
 scene::ISkinnedMesh* skinMesh = (scene::ISkinnedMesh*)mesh;
 scene::IAnimatedMeshSceneNode* node = 0;
 node = smgr->addAnimatedMeshSceneNode(skinMesh);
 node->setMaterialFlag(EMF_LIGHTING, false);


 irr::scene::ISceneNode* rightJointNode = node->getJointNode("rwrist");
 irr::scene::ISceneNode* leftJointNode = node->getJointNode("lwrist");

 // Inits Particle Engine
 // Sets the update step
 SPK::System::setClampStep(true, 1.0f); // clamp the step to 100 ms
 SPK::System::useAdaptiveStep(0.001f, 0.01f); // use an adaptive step from 1ms to 10ms (1000fps to 100fps)

 scene::CSPKParticleSystemNode* rsystem = new scene::CSPKParticleSystemNode(createMagicSystem(device, false), rightJointNode, smgr);
 scene::CSPKParticleSystemNode* lsystem = new scene::CSPKParticleSystemNode(createMagicSystem(device, true), leftJointNode, smgr);
 rsystem->drop(); // We let the scene manager take care of the system life time
 lsystem->drop();
 


{
 irr::ITimer* timer = device->getTimer();
 float oldTime=0.0f, deltaTime=0.0f, time = timer->getTime() / 1000.0f;

 while(device->run())
 {
 
// Update time
 oldTime = time;
 time = timer->getTime() / 1000.0f;
 deltaTime = time - oldTime;

 driver->beginScene(true, true, irr::video::SColor(0,0,0,0));

 // Renders scene
 smgr->drawAll();
 
irr::core::stringw infos; infos+="FPS: "; infos+=driver->getFPS();
 infos += " - Nb Particles: "; infos += rsystem->getNbParticles() + lsystem->getNbParticles();
 guienv->getBuiltInFont()->draw(infos.c_str(),irr::core::rect<irr::s32>(0,0,170,20),irr::video::SColor(255,255,255,255));

 driver->endScene();
 }

 SPK_DUMP_MEMORY
 }
 device->drop();
 SPK_DUMP_MEMORY

 return 0;
}

edit: I just downloaded your model, will test with it after lunch.

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 7:36 am

Yep works now. Thanks I'll try to continue to get use to spark2.
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 7:44 am

Here one thing that I'm not use to. How do you set a constant color for particles. Say my floating point color for a particle is.
red:0.466667,green:0.894118,blue:0.419608.
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 8:08 am

Instead of using a GraphInterpolator, you can just use a DefaultInitializer on the color parameter.

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 8:13 am

So would I be able to pass a float instead of hex?
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 8:25 am

Yes. Just do this:
Code:

SPK::Ref<SPK::ColorDefaultInitializer> cinit = SPK::ColorDefaultInitializer::create(SPK::Color(...));
group->setColorInterpolator(cinit);


_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 8:30 am

SPK::Ref<SPK::ColorDefaultInitializer> cinit = SPK::ColorDefaultInitializer::create(SPK::Color(0.4,0.9,0.4,1.0));
group->setColorInterpolator(cinit);

Correct?
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 8:34 am

Normally yes.

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 8:35 am

Cant see particles no more
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 8:38 am

Disrgard I have it, it expects double from 0 -255 not a float 0f 0 and 1.
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 8:47 am

Yep. Float colors are generally useless, as they're converted to int when passed to the gpu.

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 12:52 pm

When you return. what's the best way to move our spark node slightly in a given direction. Lets say I passed the joint node as the parent but need to slightly move it forward on the z axis to align where his hand actually is not necessarily where the joint connects.


Also I know spark handles particles but does it have support for contrail also known as trails and other names.
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Wed Feb 12, 2014 1:26 pm

1/ Just set the relative position (ie, setPosition()) of the spk irrlicht node to be what you want (exactly the same as for normal nodes).
2/ Yes, you can make trails using SPARK. However, the very nature of the trail depends on the renderer. With Irrlicht, you have to set up a static emitter, and a relatively long lifetime for particles. Also, they have to be world transformed. This should make a trail. Another method is using a trail renderer, but none was made for Irrlicht (but there is one for OpenGL, you can see the code there if you want). These renderer renders particles as trails by retaining their previous positions.

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Thu Feb 13, 2014 5:55 am

1>main.obj : error LNK2001: unresolved external symbol "public: static struct SPK::ValueType const SPK::ToSPKType<void>::type" (?type@?$ToSPKType@X@SPK@@2UValueType@2@B)
1>main.obj : error LNK2001: unresolved external symbol "private: static enum SPK::StepMode SPK::System::stepMode" (?stepMode@System@SPK@@0W4StepMode@2@A)
1>main.obj : error LNK2001: unresolved external symbol "private: static float SPK::System::minStep" (?minStep@System@SPK@@0MA)
1>main.obj : error LNK2001: unresolved external symbol "private: static float SPK::System::maxStep" (?maxStep@System@SPK@@0MA)
1>main.obj : error LNK2001: unresolved external symbol "private: static bool SPK::System::clampStepEnabled" (?clampStepEnabled@System@SPK@@0_NA)
1>main.obj : error LNK2001: unresolved external symbol "private: static float SPK::System::clampStep" (?clampStep@System@SPK@@0MA)
1>main.obj : error LNK2001: unresolved external symbol "private: static float const * const SPK::Group::DEFAULT_VALUES" (?DEFAULT_VALUES@Group@SPK@@0QBMB)
1>..\..\bin\Win32-VisualStudio\29.HardwareSkinning.exe : fatal error LNK1120: 7 unresolved externals


Trying to take my testing code and merge with my irrlicht project but I keep get unresolved issues??
I've got my project in debug and I'm linking to my debug spark libraries.

Spark_debug.lib
Spark_IRR_debug.lib

Any ideas?
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Thu Feb 13, 2014 6:09 am

Well, how is that possible since you successfully compiled it before ?!?
Anyway, make sure SPK_IMPORT is defined in your preprocessor defines (project properties).

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Thu Feb 13, 2014 6:16 am

How do you go about that?
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Thu Feb 13, 2014 6:21 am

You mean, how to change the preprocessor defines ? http://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Thu Feb 13, 2014 6:29 am

Yeah I'm probably gonna make it worse to be honest.
Back to top Go down
View user profile
Darktib
Committer


Messages : 389
Date d'inscription : 2009-07-20
Localisation : A coté de Paris

PostSubject: Re: Does spark work with Irrlicht 1.8?   Thu Feb 13, 2014 6:38 am

What do you mean ?

_________________
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Thu Feb 13, 2014 6:39 am

Not sure what to change you want me to upload maybe you can see what I cant
Back to top Go down
View user profile
The_Glitch



Messages : 69
Date d'inscription : 2014-01-17

PostSubject: Re: Does spark work with Irrlicht 1.8?   Thu Feb 13, 2014 7:00 am

http://www.mediafire.com/download/fn8nongemfpnpyc/29.HardwareSkinning.rar
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Does spark work with Irrlicht 1.8?   Today at 9:30 am

Back to top Go down
 
Does spark work with Irrlicht 1.8?
View previous topic View next topic Back to top 
Page 5 of 6Go to page : Previous  1, 2, 3, 4, 5, 6  Next
 Similar topics
-
» Take a UFC fighter to work contest.
» It’s Your Work of Art Contest *read location restrictions*
» Has Anyone Gotten Chrome Driver to Work with Windows 7?
» How do we run 10 cases out of 100 in TestNG frame work
» Does Keppra work?

Permissions in this forum:You cannot reply to topics in this forum
 :: English Forum :: Questions (en)-
Jump to: