Git Product home page Git Product logo

urho's Issues

Octree.RaycastSingle

In sample 08_Decals (Line 294):

PODVector<RayQueryResult> results;
RayOctreeQuery query(results, cameraRay, RAY_TRIANGLE, maxDistance, DRAWABLE_GEOMETRY);
scene_->GetComponent<Octree>()->RaycastSingle(query);

Crash: "pointer being freed was not allocated" on UIElement double click

Steps to reproduce:

  1. make sure native lib is recompiled as it should contain changes in glue.cpp from #35
  2. Run sample 02_HelloGUI
  3. Click on any UI button twice (with a small delay).
    Actual:
    On the second click it crashes with the following report:

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
abort() called
*** error for object 0x7f9913965340: pointer being freed was not allocated

BillboardSet_GetBillboard: Cannot marshal 'return value': Pointers cannot reference marshaled structures.

https://github.com/xamarin/urho/blob/fe6e046dcdba3bcf17b5e3759f828c52731bc663/bindings/src/BillboardSet.cs it doesn't want to marshal return struct. I investigated it and found out that boolean fields (in Rect and the Enabled) cause that. Because the bool type is not blittable (http://msdn.microsoft.com/en-us/library/75dwhxf7.aspx).
So I see two workarounds: replace bool with byte type (in both Billboard and Rect structures) or rewrite the method somehow to not to return a reference to a struct (field accessors?).

get_UIElement fails with EntryPointNotFoundException

Steps:

  1. Run 02_HelloGUI sample
  2. Click on the fish image
    Actual:
    EntryPointNotFoundException for urho_map_get_ptr is thrown
static public UIElement get_UIElement (IntPtr handle, int stringHash)
{
    return new UIElement (urho_map_get_ptr (handle, stringHash));
}```

Support for "EngineParameters"

The engine parameters are the mechanism by which the engine is configured at startup, we need to bind and surface these parameters to managed code.

Application::Setup allows the engine to be tuned here:

// Modify engine startup parameters
engineParameters_["WindowTitle"] = GetTypeName();
engineParameters_["LogName"]     = GetSubsystem<FileSystem>()->GetAppPreferencesDir("urho3d", "logs") + GetTypeName() + ".log";
engineParameters_["FullScreen"]  = false;
engineParameters_["Headless"]    = false;

Unsubscribers from events

There are lots of typed subscribers defined in UrhoObject\Object.Events such as:

SubscribeToUpdate
SubscribeToPostRenderUpdate
SubscribeToNetworkMessage

But there is no mechanism to unsubscribe from those events. Original samples use the following code:

UnsubscribeFromEvent(E_SCENEUPDATE);

where E_SCENEUPDATE is a StringHash

CodeGenerator doesn't respect C++'s enums' values.

BodyType2D in C# (generated):

public enum BodyType2D
{
    BT_STATIC,
    BT_DYNAMIC, //means 1
    BT_KINEMATIC
}

in C++:

enum BodyType2D
{
    BT_STATIC = b2_staticBody,
    BT_DYNAMIC = b2_dynamicBody, //its value is actually 2
    BT_KINEMATIC = b2_kinematicBody,
};

Write struct size validator

As we plan to hand bind the structures to match the ABI of urho, it makes sense to have a struct size and offset validator to ensure that changes to urho do not break the interop by accident

Need to retain managed objects

When an instance of a managed object is passed down, we need a wait to retain it.

So effectively, implementing toggle refs

UIElement.GetVar/SetVar (same for Node)

Some samples use it for storing some info (usually it's String or Vector type).
We can avoid using them in samples. But we can also marshal them at least with String argument.

Connection.SendRemoteEvent

From 17_SceneReplication (Line 482)

newConnection->SendRemoteEvent(E_CLIENTOBJECTID, true, remoteEventData);

Skeleton.GetBone(int)

From 13_Ragdolls (Line 109)

Skeleton& skeleton = model->GetSkeleton();
for (unsigned i = 0; i < skeleton.GetNumBones(); ++i)
  skeleton.GetBone(i)->animated_ = false;

NavigationMesh.FindPath

15_Navigation (Line 292)

navMesh->FindPath(currentPath_, jackNode_->GetPosition(), endPos_);

Plane is missing

As it turned out,Vector4 and Plane are different types. And the second one is missing.
These methods too:
Camera::SetReflectionPlane(Plane)
Camera::SetClipPlane(Plane)

From 23_Water sample

// Create a mathematical plane to represent the water in calculations
waterPlane_ = Plane(waterNode_->GetWorldRotation() * Vector3(0.0f, 1.0f, 0.0f), waterNode_->GetWorldPosition());
// Create a downward biased plane for reflection view clipping. Biasing is necessary to avoid too aggressive clipping
waterClipPlane_ = Plane(waterNode_->GetWorldRotation() * Vector3(0.0f, 1.0f, 0.0f), waterNode_->GetWorldPosition() -
    Vector3(0.0f, 0.1f, 0.0f));

// Create camera for water reflection
// It will have the same farclip and position as the main viewport camera, but uses a reflection plane to modify
// its position when rendering
reflectionCameraNode_ = cameraNode_->CreateChild();
Camera* reflectionCamera = reflectionCameraNode_->CreateComponent<Camera>();
reflectionCamera->SetFarClip(750.0);
reflectionCamera->SetViewMask(0x7fffffff); // Hide objects with only bit 31 in the viewmask (the water plane)
reflectionCamera->SetAutoAspectRatio(false);
reflectionCamera->SetUseReflection(true);
reflectionCamera->SetReflectionPlane(waterPlane_);
reflectionCamera->SetUseClipping(true); // Enable clipping of geometry behind water plane
reflectionCamera->SetClipPlane(waterClipPlane_);

Model.Clone()

From 34_DynamicGeometry (Line 155):

SharedPtr<Model> cloneModel = originalModel->Clone();

Async support

Add async support for user code.

For this to work, we need to have a "context" attached to each operation where we want to support async. In my mind, those are Update and SceneUpdate, but there might be others.

So what we would need to do is, when we first subscribe to one of those events, we need to create a SynchronizationContext for them (UpdateContext and SceneUpdateContext), and we need to make sure that when an event is "dispatched" for Update or SceneUpdate, that we save the current context, then set this as the default context for the duration of the event, and we reset it afterwards [1].

Then, we would need to make our synchronization context basically track any queued tasks, and execute any complete tasks on the update/sceneupdate event.

Ideas

Perhaps to make this work, we could provide a default SceneUpdate/Update event handlers in Application, and we encourage developers to not subscribe manually with SubscribeToSceneUpdate, but instead to set an event handler, something like:

Application.SceneUpdate += MySceneUpdate

That would centralize all of the SceneUpdates, instead of having hundreds of independent SceneUpdates everywhere.

Notes

[1] Potential problem: if a game uses a lot of subscriptions to events, say to 100 events, we do not want to have to push/pop the synchronization context 100 times. So we probably want to proxy all scene update notifications into one big group and dispatch them all at once.

Hate the Urho Enumerations

The enumerations are not very useful.

One optin is to make the enumeration values just constants that we can reference from an actual enumeration, like this:

enum MyCuteEnumeration {
Foo = UrhoEnums.ENUM_FOO_VALUE
}

So we could get the right value, and just prettify without having to manually deal with all the cases and casing that will berequired.

RenderPath.Clone

Sample: 09_MultipleViewports (line 202)

 SharedPtr<RenderPath> effectRenderPath = viewport->GetRenderPath()->Clone();

The challenge with this binding is that the Clone() return a SharedPtr, so we would need to surface the internal version of this object. Not difficult, but the side effects need to be understood.

Enumeration remapping

Currently we generate the enumeration values as they are surfaced in C, but we need to do enumeration mapping to make those first class .NET names.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.