-
-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UPBGE: Fix compound ray cast with triangle child shape. #766
Open
panzergame
wants to merge
391
commits into
master
Choose a base branch
from
ge_compound
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member functions are cheaper to call than std::function.
…tionship.[h/cpp].
ReplaceMesh function was placed into KX_Scene for no real reason, its place is more correct into KX_GameObject directly. In the same time the code part reinstancing the deformers is moved in a new function named LoadDeformer in class BL_DeformableObject. This funciton is also used by the converter to init deformes after the parenting step (for armatures).
This uniform is frequently changed between the viewport settings and in game settings, to avoid recompiling the materials only for it and has this uniform is a more a flag than a value: this uniform back to dynamic uniform. Fix issue: #609.
Previously the code parts computing AABB were using a condition to detect the first point computed used to initialize the AABB dimensions. But this method requiered a test at each points and also to be able to detect the first point. To avoid these restrictions the AABB dimension is initialized to float min for max and float max for min. This make sure that any point will affect the AABB the first time.
THe deformer conversion have some extra constraint, first it had to be placed before the RAS_MeshUser are created with AddMeshUser, secondly BL_ShapeDeformer have to check the case when parent object is null. Also the function BL_SkinDeformer::SetArmature became useless and the construtors in deformers in case of conversion of non-replicated object are removed because unused anymore.
The call to ConvertScene wasn't taking care if the scene existed because it's name was valid. This function call is moved down in a if block. Fix issue: #615.
This cleanup contains a uncrusty pass.
Previously the servo control logic brick was able to control only the linear velocity using force. But some users showed that in some non-rare case it could be needed to servo control the angular velocity via torques. To fill this gap, the servo control logic brick exposes a enum named "Servo Type" to select either linear or angular velocity, linear is the default. This option is used in KX_ObjectActuator to compute from linear or angular velocity a force or torque. Note: The reference object in case of angular velocity is just used to substract its angular velocity contrary to linear velocity which compute the linear velocity of the reference object on the position of the affected object.
This cleanup contains: - uncrustify pass - use range loop - remove friend class
Previously the inexistance of a python component manager forced in KX_Scene to iterate over all the object to ask for a component update. The implementation of a manager with a registering mechanism help to avoid this iteration and optimize as much as possible the case where a scene doesn't update any components.
…::GetChildren. The functions GetChildren and GetChildrenRecursive were not used only for the python API but also for the animation and duplication process, in these last cases the creation of a std::vector is cheaper and more easy to use. For the python API prupose, EXP_ListValue now had a constructor taking a std::vector to copy items from.
The properties in EXP_Value now use a std::map value instead of a pointer to std::map, the economy is pretty low with a pointer. The m_error flag is removed in favor of a virtual function IsError redefined in EXP_ErrorValue to return true.
This reverts commit 1a47594.
Previously the vertex remap was resized with default value to -1 but if this list wasn't empty the previous value were kept. To initialize all values to -1 std::fill is used. Fix issue: #622.
Two functions are added to replace frequently used behaviour: remove if an element is found in a list, or add if an element is not present in a list. The functions CM_ListRemoveIfFound and CM_ListAddIfNotFound assume these goal, they are defined in new file CM_List.h.
* UPBGE: Implement new Lamp Falloff - Inverse Square Cutoff for Lamps. Describes here: https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/ Original code by @DCubix. Slightly modified by me to add light preview. New Radius & CutOff parameters exposed in UI when you select "Inverse Square CutOff" falloff type in point and spot lamps For feature request #728
All texts are using a unique material per scene and so a unique material bucket and display array bucket. They both are owned by the bucket manager (RAS_BucketManager). In case of libload all the material buckets of the loaded scene are moved into the destination scene bucket manager. In case of text material the material bucket of the loaded was moved but also destructed when the loaded was freed at the end of the libload, this created an illegal memory access. To solve this issue, the only proper way found is to discard the material bucket dedicated to text when mergin the bucket manager and when merging the objects, for font objects force the recreation of the text user (RAS_TextUser) to be sure that this one is linked to the display array bucket for texts of the destination scene. Tested with valgrind.
Previously it was a float array but some code is converting it back to mt::mat4. As mt::mat4 has a direct array acces the cost is the same as a float array.
Workaround for weird MSVC2015 compiler
The assertion in Mathutils_RegisterCallback was raised when all the callbacks were registered (freestyle and bmesh too). But this assertion introduced in 1b74ec9 is wrong. The test i + 1 < MAX suppose that the last callback is a null sentinel. But this is not the case as no one is using this to stop a loop and the loop in Mathutils_RegisterCallback must stop when it find a null slot or that the slot is already containing the callback, otherwise it's an error. It's impossible to stop the loop with all regular slots registered and and different from the one intenting to register. Fix a part of issue #785.
gl_Color is set as the vertex color of the first color layer, this was broken by the addressu sage of RAS_DisplayArrayLayout::colors instead of RAS_DisplayArrayLayout::colors[0]. Fix issue #784.
These's modifications were pulled for unknown reason, sorry…
In the interest of futur way to start a game from a memory file, the exit information should not track only the file name but also more data. To do so the exit informations are standardized into the struct KX_ExitInfo which holds the exit code and the file name for the moment. This struct is stored into the ketsji engine and returned by KX_KetsjiEngine::GetExitInfo. Inside LA_Launcher::EngineNextFrame an exit code can be generated (only for window exit or exit key) and the exit info is returned. This same exit info is checked in LA_Launcher::EngineMainLoop when it contains a exit code different from NO_REQUESTS this function returns and so abort the launcher. Finally the creator of the launcher is using this exit info in case or restart or start to get the file name. In the same time the restoration of cursor visibility is moved into GPG_ghost and BL_KetsjiEmbedStart instead of the launcher.
The function SetCullFace now use a state from RAS_Rasterizer to skip unecessary opengl calls. Also the rendering of plane to screen is now using the function SetFrontFace instead disabling and renabling the face culling.
The shader used to blur a texture was using ftransform for gl_Position and so it needed the modelview/prjection matrix to be set. This can be avoided by using gl_Vertex directly.
The python main loop is using PythonMainLoopState struct to get the launcher and set the exit info, but the launcher wasn't set.
panzergame
force-pushed
the
ge_compound
branch
from
August 19, 2018 15:53
ee429e8
to
fbbd184
Compare
Previously when a compound shape was hit by a ray cast the information about the children triangles was inaccessible because of a lack from the bullet API. To fix this issue we have to keep the triangle index but add a child index of the compound child shape hit. m_childIndex is dedicated for in LocalRayResult and its value is set in rayTestSingleInternal, -1 for non compound shapes. This value is catch from FilterClosestRayResultCallback and used in RayTest to get the actual collision shape. To still get the shape construction info of the children, each collision shape created has as user pointer the shape costruction info. This object is get in RayTest to find the mesh and polygon. Tested with: - mix of convex and concave shape in a compound shape. - non compound concave and convex shape.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously when a compound shape was hit by a ray cast the information about
the children triangles was inaccessible because of a lack from the bullet
API.
To fix this issue we have to keep the triangle index but add a child index
of the compound child shape hit. m_childIndex is dedicated for in LocalRayResult
and its value is set in rayTestSingleInternal, -1 for non compound shapes.
This value is catch from FilterClosestRayResultCallback and used in RayTest
to get the actual collision shape. To still get the shape construction info
of the children, each collision shape created has as user pointer the
shape costruction info. This object is get in RayTest to find the mesh
and polygon.
Tested with:
Example file:
ge_compound.zip
The hit polygon color is set to red. The compound shape is made of two triangle mesh (concave) and a box (convex), the fourth object is a non-compound triangle mesh (concave).