Jump to content

Search the Community

Showing results for tags 'C++'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to UNIGINE Forums
    • News & Announcements
    • Getting started
  • Development
    • Content Creation
    • World Design
    • Rendering
    • Animation
    • Physics, Navigation and Path Finding
    • UI Systems
    • Sound & Video
    • Editor
    • C++ Programming
    • C# Programming
    • Networking
    • Sim IG (Image Generator)
    • VR Discussions
    • General
  • Improving UNIGINE
    • Documentation
    • Feedback for UNIGINE team
    • Bug Reports
    • Unigine SDK Beta feedback
  • Community
    • Add-on Store (https://store.unigine.com/)
    • Showcase
    • Collaboration
    • Tools, Plugins, Materials & Tutorials
    • General Discussions
  • Legacy
    • UnigineScript

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

  1. Create custom Widget element

    I have no idea, how to implement custom Widget element. In Qt i can do something like this: #include <QWidget> #include <QToolButton> #include <QLineEdit> #include <QSpacerItem> class CustomEditor : public QWidget { public: CustomEditor(QWidget *_parent = nullptr): QWidget(_parent) { m_btn = new QToolButton(this); m_btn->setText("Btn"); m_edit = new QLineEdit(this); QHBoxLayout *lt = new QHBoxLayout(this); setLayout(lt); lt->addWidget(m_edit); lt->addWidget(m_btn); } private: QToolButton *m_btn; QLineEdit *m_edit; }; And then use CustomEditor with layout manager or set for QTreeWidget, QTableWidget, QListWidget. But in Unigine i can't derive CustomEditor from Widget, in this case i must implement all of virtual functions. How i can implement complex ui element?
  2. C++ examples for Widget classes

    Hi community, the documentation for widget usages with c++ is not very big at the moment and most things I have to try by myself which is very time consuming because there are no examples. I hope this will get better. Currently I am stuck with WidgetHBox class. Can anybody tell me how to connect WidgetLabels to them with c++ code. A small example would be great. Thanks Sebastian
  3. openCV slow frame reading

    I'm using openCV in Unigine project. Function cv::VideoCapture::read() works pretty fast alone and within Unreal Engine. But calling it from Unigine::WorldLogic::update() is very slow (15 FPS). What are the possible reasons and how can I fix it?
  4. How can I set the WASD movement speed for a PlayerDummy object? There is an old question on the forums but that solution no longer applies (set min and max velocity in tools->camera). I can set the WASD speed in the editor bit that's saved in the editor config file not the .world
  5. I'm trying to get a screenshot using the function "Viewport::renderImage2D". But the result of the picture is not like the truth. Can I see an example of getting a screenshot in C ++, and that the result is the same as using the console command "video_grab"? Thank you in advance.
  6. Hello, I noticed that updating the world spatial takes a very long time (about 40 ms), and since it does this every frame, it sort of ruins my frame rate. The reason that world spatial takes so long is because it performs over 10000 (ten-thousand) calls to WorldSpatial::getIntersection. The high number of calls is related to the number of extra vehicles I have moving about in the world. With only 1 extra vehicle it only calls WorldSpatial::getIntersection a hundred times during an update. With 5 vehicles it's a 150, 10 vehicles sets it a 300, 20 vehicles at 900, you get the picture. Is there anyway to tell unigine to completely ignore during a world spatial update. We complete control the vehicles in the software (from where there going to where they appear). We only need Unigine to draw the vehicles and let us do the rest. The vehicles consists out of several nodes (body, interior, lights and wheels) and a physical trigger (box), that we use for colision detection. I tried to set the spatial property (node->setSpatial) to 0, but that didn't do anything. Any help would be appriaciated. Kind regards, Kai P.s.: I'm using Unigine 2.3.
  7. I'm trying to find out how to set an array as a value of json node. I can't understand how to use setArray() without argument, and on the "c++" tab of related page of documentation only example for UnigineScript are given.
  8. I have the following situation: In my application there are 2 important threads (there are more, but only 2 are involved in the application): One thread that periodically calls WorldNode::getIntersection (well, it calls WorldInterface::getIntersection) in order to perform calculations based on the location of the player and another thread that does everything else (rendering, drawing graphics, handling user input, etc). The application crashes at random (sometimes after 5 minutes, sometimes after an hour), but a core dump always reveals that the crash was caused by a SIGABRT raised from WorldNode::getIntersection. Since this happens at random, I figure its thread-related (i.e.: Thread1 is calling a getIntersection, just as Thread2 is updating something). Can someone verify / refute this. Alternate theories on why this happens are welcome. I'm using Unigine V2.3.
  9. clone() method help

    We're working on having a trail of dust (ObjectParticles), and wish to set up a node of ObjectParticles one time and then clone it as it's needed. ObjectParticlesPtr sand_kick_actual = ObjectParticles::cast(Editor::get()->getNodeByName("ObjectParticles_0")->getNode()->clone()); sand_kick_actual->setEnabled(0); sand_kick_actual->setRadius(0.01f, 0.01f); sand_kick_actual->setWorldPosition(path_world_pos + random_offset); sand_kick_actual->setEnabled(1); However, at run-time this causes the following error message; Assertion failed! Program: ...ments\UNIGINE Projects\PBKC_2\bin\Unigine_x64d.dll File: engine\world\WorldSpatial.cpp Line: 2125 Expression: positions.find(position) != positions.end() && "WorldSpatial::removePosition(): can't find position" How do you go about cloning particle systems (or nodes in general) ?
  10. I cannot figure out how to render the current window to an Image or ImagePtr object. Does anyone have an example code snipped that works? I have tried doing it with the console command "video_grab" but that isn't fast enough. I've also tried the Viewport object and the Renderer object's API. ImagePtr image = Image::create(); image->create2D(1024, 576, Image::FORMAT_RGBA8, 1, 1); PlayerSpectatorPtr player = PlayerSpectator::create(); player->setPosition(Math::Vec3(0, 0, 2.0f)); CameraPtr camera = player->getCamera()->clone(); ViewportPtr viewport = Viewport::create(); Render *render = Unigine::Render::get(); render->setViewport(viewport); image->create2D(1024, 576, Image::FORMAT_RGBA8, 1, 1, 1); render->renderImage2D(camera, image, 0); The last line cases a crash of the application. I am using the C++ interface on the 2.5 SDK.
  11. The below code adds a button to the screen when run in main()/winmain() GuiPtr gui = Unigine::Gui::get(); WidgetButtonPtr widget_button = WidgetButton::create(gui, "click"); widget_button->setCallback0(Gui::CLICKED, MakeCallback(Utils::testit)); gui->addChild(widget_button->getWidget(), Gui::ALIGN_TOP); When the same code is run from AppWorldLogic::init() the button does not appear, even though the routine is run. Any idea where I'm going wrong?
  12. Hi all, Just wondering if anyone has had any luck integrating the Vive trackers into Unigine. from what i can tell the SDK doesn't currently support it out of the box, and i'm not entirely sure how best to approach it. My original plan was to import the OpenVR library, and use that, however, it looks like Unigine's Builtin VR Implementation is disagreeing with it. Thanks in advance for any assistance or insight.
  13. I am trying to get a vehicle to interact with a physical trigger in the world, but the objects don't interact and no callback is ever called. For creating the physical trigger I use the following code: //Create a box-shaped trigger, with size 0. m_physical = Unigine::PhysicalTrigger::create(3, Unigine::Math::vec3()); m_physical->setVisible(true); m_physical->setEnabled(true); m_physical->setCollisionMask(-1); m_physical->setPhysicalMask(-1); m_physical->setExclusionMask(0); m_physical->setEnterCallback(new cHitCallback(this)); Elsewhere in the code, the size, location and rotation is set. To make sure that the trigger is at the expected place, I draw it on screen with with the following code: Unigine::Visualizer::get()->renderSolidBox(m_physical->getSize(), m_physical->getWorldTransform(), m_color); The vehicle has a body and shape created like this: Unigine::ObjectPtr body = Unigine::Object::cast (m_body_node->getReference()) ; m_rigidBody = Unigine::BodyRigid::create(); m_boxShape = Unigine::ShapeBox::create(Unigine::Math::vec3(4.78, 2.52, 3.10)); m_boxShape->setCollisionMask(-1); m_boxShape->setExclusionMask(0); m_boxShape->setEnabled(1); m_rigidBody->addShape(m_boxShape->getShape()); m_rigidBody->setPhysicalMask(-1); m_rigidBody->setEnabled(1); body->setBody(m_rigidBody->getBody()); For testing purposes, I used the following line to visualize the shape of my vehicle: Unigine::Visualizer::get()->renderBox(m_boxShape->getSize(), m_rigidBody->getTransform(), Unigine::Math::vec4(0, 0, 1.0, 1.0)); I have placed a break point in the callbackmethod "void run(Unigine::Ptr<Unigine::Body> body)" of the cHitCallback class, to make sure that the callback is infact called. The break point is never triggered. Did I miss something here? Please help me out.
  14. Hi: I can't find any C++ api rewriting image to viewPort(screen), can you give some advise? thanks.
  15. What steps should be performed to keep the viewport position preserved after window resize. My current implementation is clipping the rendering on the right as visible in attached screenshot.
  16. Best practise to reload world

    We have integrated Unigine 2.4.1 into our application using the App Interface, I had a few querys 1. There seem to appear some crash/hang on new world load. I wanted to know which all areas should be take care of while loading a new world. Currently we are using the "world_load" command to load a new world. 2. Is there any callback or API which can be used to check if all the materials in the world are loaded, as to avoid rendering loading of materials on "world_load" command. Thank you.
  17. [SOLVED] Crash of application.

    I am loading the world through unigine as following, char cWorldPath[] = "world_load XYZ/XYZ"; Unigine::Engine *engine = Unigine::Engine::get(); Unigine::Console * console = Unigine::Console::get(); console->setActivity(1); console->run(cWorldPath); console->flush(); console->setActivity(0); int iNumPlugin = engine->findPlugin("MyPlugin"); MyPlugin *pPlugin = (MyPlugin*) engine->getPluginData(iNumPlugin); pPlugin->isWorldLoad(); // this function checks world is loaded or not and if loaded it loads tracks. everything is fine so far, but when I load the second world through the same process and try to call the plugin functions for rendering I get an Assertion as follows, --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Assertion failed! Program: ... File: U:\source\engine\EngineInterpreter.h Line: 86 Expression: depth < NUM_INSTANCES && "EngineInterpreterInstance::begin(): stack overflow" For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts (Press Retry to debug the application - JIT must be enabled) --------------------------- Abort Retry Ignore --------------------------- I tried debugging throught the code and figured out that the problem seems to be in, void Machine::run(int begin,Interpreter::Context *context) which throws an access violation First-chance exception at 0x000007fed3f91e56 (.dll) in XYZ .exe: 0xC0000005: Access violation reading location 0x0000000000000208. on evey call to it, the trace to which is as follows, TRACE: Machine::run(int begin, Interpreter::Context * context) Line 57 C++ Interpreter::runFunction(int function, int num_args, const Variable * args) Line 6545 C++ Interpreter::runFunction(const char * name, int num_args, const Variable * args) Line 6475 C++ Interpreter::runFunction(const Variable & name, int num_args, const Variable * args) Line 6470 C++ Unigine::run_system_function(const Unigine::Variable & name) Line 1144 + 0x19 bytes C++ MyPlugin.dll!MyPlugin::cut() Line 41 + 0x40 bytes C++ MyPlugin.dll!MyPlugin::setIndex(SWITCHER_LAYER _layer) Line 78 C++ the execution is lost from the SWITCH case not sure where exactly but mostly in the CASE(CALLECFR). So what am I missing here, is there any closing steps needed to be undertaken before loading a new world or any reinitialization required before calling plugin functions?
  18. Class Export

    hi I have created a getter and setter class in external c++ code and exported my class as:- ExternClass<CUnigineSupport> *m_unigineSupport = MakeExternClass<CUnigineSupport>(); m_unigineSupport->addConstructor(); m_unigineSupport->addFunction("getworldLoad",&CUnigineSupport::getvalue); m_unigineSupport->addFunction("setworldLoad",&CUnigineSupport::setvalue); Interpreter::addExternClass("CUnigineSupport",m_unigineSupport); and trying to call from System script (Note: Class is exported before init engine called ) by:- int init() { CUnigineSupport extern_object = new CUnigineSupport(); int tempVal = extern_object.getvalue(); log.message("\nvalue is: %d",tempVal); return 1; } I am getting error as:- Interpreter::parse(): unknown token "CUnigineSupport" Am I missing something while exporting class. Thanks
  19. Hi everyone, There are a question about rotate a node, There is the default material in the new C++ project's scene: After rotate the material_ball about Y-axis by these code: node = Editor::get()->getNodeByName("material_ball"); Mat4 transform = node.get()->getTransform(); mat4 rot = rotateY(90.0f); node.get()->setTransform(transform * Mat4(rot)); The material_ball become this: And then I rotate it about Z-axis by these code: node = Editor::get()->getNodeByName("material_ball"); Mat4 transform = node.get()->getTransform(); mat4 rot = rotateY(90.0f); mat4 rot2 = rotateZ(-30.0f); node.get()->setTransform(transform * Mat4(rot) * Mat4(rot2)); The material_ball become this: Form the above view, I find that the rotate function is rote the node about it's own axis, How can I rotate it about the world axis ? I have tried the setWorldTransform function like this: node = Editor::get()->getNodeByName("material_ball"); Mat4 transform = node.get()->getWorldTransform(); mat4 rot = rotateY(90.0f); mat4 rot2 = rotateZ(-30.0f); node.get()->setWorldTransform(transform * Mat4(rot) * Mat4(rot2)); But it's result is the same with setTransform function.
  20. Hi , I'm a fresh Unigine learner. I have a question about operate the model in the scene. The total function I wanna realize is that : a. I can import a model(.obj) though the C++ call Unigine API(I've realized this function). b. I can pick one of the models in scene. c. I can move the model I picked in the scene. d. I can rotate the model I picked in the scene. e. I can zoom out and zoom in the model i picked in the scene. please tell me which class can help me to realize those function, Or can you give me some samples? Thanks. Ivy.
  21. [SOLVED] UnigineSocket header is missing

    Hi there could it be, that the UnigineSocket.h file is missing in the 2.2.1 release? I can't find it anywhere in the release and due to the documentation it should be there. Kind regards, Renato
  22. When attempting to run the code in C++: Visualizer::get()->renderLine3D( transform * m_vertices[0], transform * m_vertices[1], m_color ); where transform is a 4x4 matrix, m_vertices is an array of vec3's and m_color is a vec4, I get the following exception: Exception thrown: read access violation. val was 0xFFFFFFFFFFFFFFFF. The call stack is: Unigine:VisualizerInterface::renderLine2D Visualizer::renderLine2D Unigine::Math::bvec4::set This is a little bit strange since I'm calling the renderLine3D. Any ideas what's going on? Thank you, Andrew
  23. Hi. We are working on Unigine 2.1.1 start version now. We are working GUI Process on only c++. (Not Use Unigine Script) Which headerfile defines WidgetSpriteVideo and WidgetSpriteNode class? please help!!!!!
  24. It is pretty common for smart pointers nowadays to implement bool() operator. (See std:: for instance) Maybe you could add to UniginePtr.h something like /** * Test if the pointer object owns a resource */ UNIGINE_INLINE explicit operator bool() const { return (this->get() != nullptr); } With this you can use safe patterns like : if (Unigine::Ptr<Something> ptr = methodToGetPtr()) { // ptr is guaranteed not to be nullptr here // Do something with ptr ... } // ptr is not defined here so cannot be misused.
  25. App Class

    Hey chaps =) I'm trying to create a custom made window and let unigine render into it. I was looking through your documentation of the App Class, as well as the samples for QT in combination with opengl or direct3d. I'm still struggling and my intention is to simply create a blank fullscreen window in Windows and render into it what the engine is producing. I'm hoping for a start-up aid =) Kind regards, Renato
×
×
  • Create New...