simPath.cpp

Engine/source/scene/simPath.cpp

More...

Namespaces:

namespace

Public Variables

Public Functions

ConsoleDocClass(Marker , "@brief A single joint, or knot, along <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path. Should be stored inside <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Path container object. A path markers can <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">be\n</a>" "one of three primary movement types:\"normal\" , \"Position Only\" , or \"Kink\". \n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> path()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "     isLooping = \"1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "     <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classmarker/">Marker</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "		{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			seqNum = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			type = \"Normal\";\n" "			msToNext = \"1000\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			smoothingType = \"Spline\";\n" "			position = \"-0.054708 -35.0612 234.802\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			rotation = \"1 0 0 0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "      };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "	};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Path\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enviroMisc\n</a>" )
ConsoleDocClass(SimPath::Path , "@brief A spline along which various objects can move along. The spline object acts like <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> container <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/class/classmarker/">Marker</a> objects, which <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">make\n</a>" "up the joints, or knots, along the path. Paths can be assigned <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> speed, can be looping or non-looping. Each of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path 's markers can <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">be\n</a>" "one of three primary movement types:\"normal\" , \"Position Only\" , or \"Kink\". \n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> path()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "     isLooping = \"1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "     <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classmarker/">Marker</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "		{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			seqNum = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			type = \"Normal\";\n" "			msToNext = \"1000\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			smoothingType = \"Spline\";\n" "			position = \"-0.054708 -35.0612 234.802\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			rotation = \"1 0 0 0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "      };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "	};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Marker\n</a>" "@see NetConnection::transmitPaths()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see NetConnection::clearPaths()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Path\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enviroMisc\n</a>" )
DefineEngineFunction(pathOnMissionLoadDone , void , () , "@brief Load all Path information from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mission.\n\n</a>" "This function is usually called from the loadMissionStage2() server-side function " "after the mission <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> has loaded. Internally it places all Paths into the server's " "PathManager. From this point the Paths are ready <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> transmission <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">clients.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Inform the engine <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> load all Path information from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mission.\n</a>" "pathOnMissionLoadDone();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see NetConnection::transmitPaths()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see NetConnection::clearPaths()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Path\n</a>" "@ingroup Networking" )
ImplementEnumType(MarkerKnotType , "The type of knot that this marker will <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">be.\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enviroMisc\n\n</a>" )
ImplementEnumType(MarkerSmoothingType , "The type of smoothing this marker will have <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> pathed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">objects.\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enviroMisc\n\n</a>" )

Detailed Description

Public Variables

 EndImplementEnumType 
bool gEditingMission 

For frame signal.

Point3F wedgePoints [4]

Public Functions

cmpPathObject(const void * p1, const void * p2)

ConsoleDocClass(Marker , "@brief A single joint, or knot, along <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path. Should be stored inside <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Path container object. A path markers can <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">be\n</a>" "one of three primary movement types:\"normal\" , \"Position Only\" , or \"Kink\". \n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> path()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "     isLooping = \"1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "     <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classmarker/">Marker</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "		{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			seqNum = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			type = \"Normal\";\n" "			msToNext = \"1000\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			smoothingType = \"Spline\";\n" "			position = \"-0.054708 -35.0612 234.802\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			rotation = \"1 0 0 0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "      };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "	};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Path\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enviroMisc\n</a>" )

ConsoleDocClass(SimPath::Path , "@brief A spline along which various objects can move along. The spline object acts like <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> container <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/class/classmarker/">Marker</a> objects, which <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">make\n</a>" "up the joints, or knots, along the path. Paths can be assigned <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> speed, can be looping or non-looping. Each of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path 's markers can <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">be\n</a>" "one of three primary movement types:\"normal\" , \"Position Only\" , or \"Kink\". \n" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "<a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> path()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " {\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "     isLooping = \"1\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "     <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/class/classmarker/">Marker</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "		{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			seqNum = \"0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			type = \"Normal\";\n" "			msToNext = \"1000\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			smoothingType = \"Spline\";\n" "			position = \"-0.054708 -35.0612 234.802\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "			rotation = \"1 0 0 0\";\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "      };\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "	};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Marker\n</a>" "@see NetConnection::transmitPaths()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see NetConnection::clearPaths()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Path\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enviroMisc\n</a>" )

DefineEngineFunction(pathOnMissionLoadDone , void , () , "@brief Load all Path information from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mission.\n\n</a>" "This function is usually called from the loadMissionStage2() server-side function " "after the mission <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> has loaded. Internally it places all Paths into the server's " "PathManager. From this point the Paths are ready <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> transmission <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">clients.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Inform the engine <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> load all Path information from the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mission.\n</a>" "pathOnMissionLoadDone();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see NetConnection::transmitPaths()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see NetConnection::clearPaths()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Path\n</a>" "@ingroup Networking" )

IMPLEMENT_CO_NETOBJECT_V1(Marker )

ImplementEnumType(MarkerKnotType , "The type of knot that this marker will <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">be.\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enviroMisc\n\n</a>" )

ImplementEnumType(MarkerSmoothingType , "The type of smoothing this marker will have <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> pathed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">objects.\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enviroMisc\n\n</a>" )

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24#include "platform/platform.h"
 25#include "scene/simPath.h"
 26
 27#include "gfx/gfxDevice.h"
 28#include "gfx/gfxVertexBuffer.h"
 29#include "gfx/gfxPrimitiveBuffer.h"
 30#include "gfx/gfxTransformSaver.h"
 31#include "console/consoleTypes.h"
 32#include "scene/pathManager.h"
 33#include "scene/sceneRenderState.h"
 34#include "math/mathIO.h"
 35#include "core/stream/bitStream.h"
 36#include "renderInstance/renderPassManager.h"
 37#include "console/engineAPI.h"
 38#include "T3D/pathShape.h"
 39
 40#include "T3D/Scene.h"
 41
 42extern bool gEditingMission;
 43
 44//--------------------------------------------------------------------------
 45//-------------------------------------- Console functions and cmp funcs
 46//
 47DefineEngineFunction(pathOnMissionLoadDone, void, (),,
 48   "@brief Load all Path information from the mission.\n\n"
 49
 50   "This function is usually called from the loadMissionStage2() server-side function "
 51   "after the mission file has loaded.  Internally it places all Paths into the server's "
 52   "PathManager.  From this point the Paths are ready for transmission to the clients.\n\n"
 53
 54   "@tsexample\n"
 55      "// Inform the engine to load all Path information from the mission.\n"
 56      "pathOnMissionLoadDone();\n\n"
 57   "@endtsexample\n"
 58
 59   "@see NetConnection::transmitPaths()\n"
 60   "@see NetConnection::clearPaths()\n"
 61   "@see Path\n"
 62
 63   "@ingroup Networking")
 64{
 65   // Need to load subobjects for all loaded interiors...
 66   Scene* scene = Scene::getRootScene();
 67   AssertFatal(scene != NULL, "Error, mission done loading and no scene?");
 68
 69   U32 currStart = 0;
 70   U32 currEnd   = 1;
 71   Vector<SimGroup*> groups;
 72   groups.push_back(scene);
 73
 74   while (true) {
 75      for (U32 i = currStart; i < currEnd; i++) {
 76         for (SimGroup::iterator itr = groups[i]->begin(); itr != groups[i]->end(); itr++) {
 77            if (dynamic_cast<SimGroup*>(*itr) != NULL)
 78               groups.push_back(static_cast<SimGroup*>(*itr));
 79         }
 80      }
 81
 82      if (groups.size() == currEnd) {
 83         break;
 84      } else {
 85         currStart = currEnd;
 86         currEnd   = groups.size();
 87      }
 88   }
 89
 90   for (U32 i = 0; i < groups.size(); i++) {
 91      SimPath::Path* pPath = dynamic_cast<SimPath::Path*>(groups[i]);
 92      if (pPath)
 93         pPath->updatePath();
 94   }
 95}
 96
 97S32 FN_CDECL cmpPathObject(const void* p1, const void* p2)
 98{
 99   SimObject* o1 = *((SimObject**)p1);
100   SimObject* o2 = *((SimObject**)p2);
101
102   Marker* m1 = dynamic_cast<Marker*>(o1);
103   Marker* m2 = dynamic_cast<Marker*>(o2);
104
105   if (m1 == NULL && m2 == NULL)
106      return 0;
107   else if (m1 != NULL && m2 == NULL)
108      return 1;
109   else if (m1 == NULL && m2 != NULL)
110      return -1;
111   else {
112      // Both markers...
113      return S32(m1->mSeqNum) - S32(m2->mSeqNum);
114   }
115}
116
117ConsoleDocClass(SimPath::Path,
118   "@brief A spline along which various objects can move along. The spline object acts like a container for Marker objects, which make\n"
119   "up the joints, or knots, along the path. Paths can be assigned a speed, can be looping or non-looping. Each of a path's markers can be\n"
120   "one of three primary movement types: \"normal\", \"Position Only\", or \"Kink\". \n"
121
122   "@tsexample\n"
123      "new path()\n"
124      "  {\n"
125       "     isLooping = \"1\";\n"
126       "\n"
127       "     new Marker()\n"
128       "    {\n"
129       "       seqNum = \"0\";\n"
130       "       type = \"Normal\";\n"
131       "       msToNext = \"1000\";\n"
132       "       smoothingType = \"Spline\";\n"
133       "       position = \"-0.054708 -35.0612 234.802\";\n"
134       "       rotation = \"1 0 0 0\";\n"
135      "      };\n"
136      "\n"
137      "  };\n"
138   "@endtsexample\n"
139
140   "@see Marker\n"
141   "@see NetConnection::transmitPaths()\n"
142   "@see NetConnection::clearPaths()\n"
143   "@see Path\n"
144
145   "@ingroup enviroMisc\n"
146);
147
148namespace SimPath
149{
150
151//--------------------------------------------------------------------------
152//-------------------------------------- Implementation
153//
154IMPLEMENT_CONOBJECT(Path);
155
156Path::Path()
157{
158   mPathIndex = NoPathIndex;
159   mIsLooping = true;
160   mPathSpeed = 1.0f;
161   mDataBlock = NULL;
162   mSpawnCount = 1;
163   mMinDelay = 0;
164   mMaxDelay = 0;
165}
166
167Path::~Path()
168{
169   //
170}
171
172//--------------------------------------------------------------------------
173void Path::initPersistFields()
174{
175   addField("isLooping",   TypeBool, Offset(mIsLooping, Path), "If this is true, the loop is closed, otherwise it is open.\n");
176   addField("Speed",   TypeF32, Offset(mPathSpeed, Path), "Speed.\n");
177   addProtectedField("mPathShape", TYPEID< PathShapeData >(), Offset(mDataBlock, Path),
178      &setDataBlockProperty, &defaultProtectedGetFn,
179      "@brief Spawned PathShape.\n\n");
180   addField("spawnCount", TypeS32, Offset(mSpawnCount, Path), "Spawn Count.\n");
181   addField("minDelay", TypeS32, Offset(mMinDelay, Path), "Spawn Delay (min).\n");
182   addField("maxDelay", TypeS32, Offset(mMaxDelay, Path), "Spawn Delay (max).\n");
183
184   Parent::initPersistFields();
185   //
186}
187
188
189
190//--------------------------------------------------------------------------
191bool Path::onAdd()
192{
193   if(!Parent::onAdd())
194      return false;
195
196   onAdd_callback(getId());
197   return true;
198}
199
200IMPLEMENT_CALLBACK(Path, onAdd, void, (SimObjectId ID), (ID),
201   "Called when this ScriptGroup is added to the system.\n"
202   "@param ID Unique object ID assigned when created (%this in script).\n"
203);
204
205void Path::onRemove()
206{
207   //
208
209   Parent::onRemove();
210}
211
212
213
214//--------------------------------------------------------------------------
215/// Sort the markers objects into sequence order
216void Path::sortMarkers()
217{
218   dQsort(mObjectList.address(), mObjectList.size(), sizeof(SimObject*), cmpPathObject);
219}
220
221void Path::updatePath()
222{
223   // If we need to, allocate a path index from the manager
224   if (mPathIndex == NoPathIndex)
225      mPathIndex = gServerPathManager->allocatePathId();
226
227   sortMarkers();
228
229   Vector<Point3F> positions;
230   Vector<QuatF>   rotations;
231   Vector<U32>     times;
232   Vector<U32>     smoothingTypes;
233
234   for (iterator itr = begin(); itr != end(); itr++)
235   {
236      Marker* pMarker = dynamic_cast<Marker*>(*itr);
237      if (pMarker != NULL)
238      {
239         Point3F pos;
240         pMarker->getTransform().getColumn(3, &pos);
241         positions.push_back(pos);
242
243         QuatF rot;
244         rot.set(pMarker->getTransform());
245         rotations.push_back(rot);
246
247         times.push_back(pMarker->mMSToNext);
248         smoothingTypes.push_back(pMarker->mSmoothingType);
249      }
250   }
251
252   gServerPathManager->updatePath(mPathIndex, positions, rotations, times, smoothingTypes, mIsLooping);
253}
254
255void Path::addObject(SimObject* obj)
256{
257   Parent::addObject(obj);
258
259   if (mPathIndex != NoPathIndex) {
260      // If we're already finished, and this object is a marker, then we need to
261      //  update our path information...
262      if (dynamic_cast<Marker*>(obj) != NULL)
263         updatePath();
264   }
265}
266
267void Path::removeObject(SimObject* obj)
268{
269   bool recalc = dynamic_cast<Marker*>(obj) != NULL;
270
271   Parent::removeObject(obj);
272
273   if (mPathIndex != NoPathIndex && recalc == true)
274      updatePath();
275}
276
277DefineEngineMethod( Path, getPathId, S32, (),,
278   "@brief Returns the PathID (not the object ID) of this path.\n\n"
279   "@return PathID (not the object ID) of this path.\n"
280   "@tsexample\n"
281      "// Acquire the PathID of this path object.\n"
282      "%pathID = %thisPath.getPathId();\n\n"
283   "@endtsexample\n\n"
284   )
285{
286   Path *path = static_cast<Path *>(object);
287   return path->getPathIndex();
288}
289
290} // Namespace
291
292//--------------------------------------------------------------------------
293//--------------------------------------------------------------------------
294
295GFXStateBlockRef Marker::smStateBlock;
296GFXVertexBufferHandle<GFXVertexPCT> Marker::smVertexBuffer;
297GFXPrimitiveBufferHandle Marker::smPrimitiveBuffer;
298
299static Point3F wedgePoints[4] = {
300   Point3F(-1, -1,  0),
301   Point3F( 0,  1,  0),
302   Point3F( 1, -1,  0),
303   Point3F( 0,-.75, .5),
304};
305
306void Marker::initGFXResources()
307{
308   if(smVertexBuffer != NULL)
309      return;
310      
311   GFXStateBlockDesc d;
312   d.cullDefined = true;
313   d.cullMode = GFXCullNone;
314   
315   smStateBlock = GFX->createStateBlock(d);
316   
317   smVertexBuffer.set(GFX, 4, GFXBufferTypeStatic);
318   GFXVertexPCT* verts = smVertexBuffer.lock();
319   verts[0].point = wedgePoints[0] * 1.25f;
320   verts[1].point = wedgePoints[1] * 1.25f;
321   verts[2].point = wedgePoints[2] * 1.25f;
322   verts[3].point = wedgePoints[3] * 1.25f;
323   verts[1].color = GFXVertexColor(ColorI(255, 0, 0, 255));
324   verts[0].color = verts[2].color = verts[3].color = GFXVertexColor(ColorI(0, 0, 255, 255));
325   smVertexBuffer.unlock();
326   
327   smPrimitiveBuffer.set(GFX, 24, 12, GFXBufferTypeStatic);
328   U16* prims;
329   smPrimitiveBuffer.lock(&prims);
330   prims[0] = 0;
331   prims[1] = 3;
332   prims[2] = 3;
333   prims[3] = 1;
334   prims[4] = 1;
335   prims[5] = 0;
336   
337   prims[6] = 3;
338   prims[7] = 1;
339   prims[8] = 1;
340   prims[9] = 2;
341   prims[10] = 2;
342   prims[11] = 3;
343   
344   prims[12] = 0;
345   prims[13] = 3;
346   prims[14] = 3;
347   prims[15] = 2;
348   prims[16] = 2;
349   prims[17] = 0;
350   
351   prims[18] = 0;
352   prims[19] = 2;
353   prims[20] = 2;
354   prims[21] = 1;
355   prims[22] = 1;
356   prims[23] = 0;
357   smPrimitiveBuffer.unlock();
358}
359
360IMPLEMENT_CO_NETOBJECT_V1(Marker);
361
362ConsoleDocClass( Marker,
363   "@brief A single joint, or knot, along a path. Should be stored inside a Path container object. A path markers can be\n"
364   "one of three primary movement types: \"normal\", \"Position Only\", or \"Kink\". \n"
365
366   "@tsexample\n"
367   "new path()\n"
368   "  {\n"
369    "     isLooping = \"1\";\n"
370    "\n"
371    "     new Marker()\n"
372    "    {\n"
373    "       seqNum = \"0\";\n"
374    "       type = \"Normal\";\n"
375    "       msToNext = \"1000\";\n"
376    "       smoothingType = \"Spline\";\n"
377    "       position = \"-0.054708 -35.0612 234.802\";\n"
378    "       rotation = \"1 0 0 0\";\n"
379   "      };\n"
380   "\n"
381   "  };\n"
382   "@endtsexample\n"
383   "@see Path\n"
384   "@ingroup enviroMisc\n"
385);
386
387Marker::Marker()
388{
389   // Not ghostable unless we're editing...
390   mNetFlags.clear(Ghostable);
391
392   mTypeMask |= MarkerObjectType;
393
394   mSeqNum   = 0;
395   mMSToNext = 1000;
396   mSmoothingType = SmoothingTypeSpline;
397   mKnotType = KnotTypeNormal;
398}
399
400Marker::~Marker()
401{
402   //
403}
404
405//--------------------------------------------------------------------------
406
407ImplementEnumType( MarkerSmoothingType,
408   "The type of smoothing this marker will have for pathed objects.\n"
409   "@ingroup enviroMisc\n\n")
410   { Marker::SmoothingTypeSpline , "Spline", "Marker will cause the movements of the pathed object to be smooth.\n" },
411   { Marker::SmoothingTypeLinear , "Linear", "Marker will have no smoothing effect.\n" },
412   //{ Marker::SmoothingTypeAccelerate , "Accelerate" },
413EndImplementEnumType;
414
415ImplementEnumType( MarkerKnotType,
416   "The type of knot that this marker will be.\n"
417   "@ingroup enviroMisc\n\n")
418   { Marker::KnotTypeNormal ,       "Normal", "Knot will have a smooth camera translation/rotation effect.\n" },
419   { Marker::KnotTypePositionOnly,  "Position Only", "Will do the same for translations, leaving rotation un-touched.\n" },
420   { Marker::KnotTypeKink,          "Kink", "The rotation will take effect immediately for an abrupt rotation change.\n" },
421EndImplementEnumType;
422
423void Marker::initPersistFields()
424{
425   addGroup( "Misc" );
426   addField("seqNum",   TypeS32, Offset(mSeqNum,   Marker), "Marker position in sequence of markers on this path.\n");
427   addField("type", TYPEID< KnotType >(), Offset(mKnotType, Marker), "Type of this marker/knot. A \"normal\" knot will have a smooth camera translation/rotation effect.\n\"Position Only\" will do the same for translations, leaving rotation un-touched.\nLastly, a \"Kink\" means the rotation will take effect immediately for an abrupt rotation change.\n");
428   addField("msToNext", TypeS32, Offset(mMSToNext, Marker), "Milliseconds to next marker in sequence.\n");
429   addField("smoothingType", TYPEID< SmoothingType >(), Offset(mSmoothingType, Marker), "Path smoothing at this marker/knot. \"Linear\" means no smoothing, while \"Spline\" means to smooth.\n");
430   endGroup("Misc");
431
432   Parent::initPersistFields();
433}
434
435//--------------------------------------------------------------------------
436bool Marker::onAdd()
437{
438   if(!Parent::onAdd())
439      return false;
440
441   mObjBox = Box3F(Point3F(-1.25, -1.25, -1.25), Point3F(1.25, 1.25, 1.25));
442   resetWorldBox();
443
444   if(gEditingMission)
445      onEditorEnable();
446
447   return true;
448}
449
450
451void Marker::onRemove()
452{
453   if(gEditingMission)
454      onEditorDisable();
455
456   Parent::onRemove();
457
458   smVertexBuffer = NULL;
459   smPrimitiveBuffer = NULL;
460}
461
462void Marker::onGroupAdd()
463{
464   mSeqNum = getGroup()->size() - 1;
465}
466
467
468/// Enable scoping so we can see this thing on the client.
469void Marker::onEditorEnable()
470{
471   mNetFlags.set(Ghostable);
472   setScopeAlways();
473   addToScene();
474}
475
476/// Disable scoping so we can see this thing on the client
477void Marker::onEditorDisable()
478{
479   removeFromScene();
480   mNetFlags.clear(Ghostable);
481   clearScopeAlways();
482}
483
484
485/// Tell our parent that this Path has been modified
486void Marker::inspectPostApply()
487{
488   SimPath::Path *path = dynamic_cast<SimPath::Path*>(getGroup());
489   if (path)
490      path->updatePath();
491}
492
493
494//--------------------------------------------------------------------------
495void Marker::prepRenderImage( SceneRenderState* state )
496{
497   // This should be sufficient for most objects that don't manage zones, and
498   //  don't need to return a specialized RenderImage...
499   ObjectRenderInst *ri = state->getRenderPass()->allocInst<ObjectRenderInst>();
500   ri->renderDelegate.bind( this, &Marker::renderObject );
501   ri->type = RenderPassManager::RIT_Editor;
502   state->getRenderPass()->addInst(ri);
503}
504
505
506void Marker::renderObject(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance* overrideMat)
507{
508   initGFXResources();
509   
510   for(U32 i = 0; i < GFX->getNumSamplers(); i++)
511      GFX->setTexture(i, NULL);
512   GFXTransformSaver saver;
513   MatrixF mat = getRenderTransform();
514   mat.scale(mObjScale);
515   GFX->multWorld(mat);
516   
517   GFX->setStateBlock(smStateBlock);
518   GFX->setVertexBuffer(smVertexBuffer);
519   GFX->setPrimitiveBuffer(smPrimitiveBuffer);
520   GFX->setupGenericShaders();
521   GFX->drawIndexedPrimitive(GFXLineList, 0, 0, 4, 0, 12);
522}
523
524
525//--------------------------------------------------------------------------
526U32 Marker::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
527{
528   U32 retMask = Parent::packUpdate(con, mask, stream);
529
530   // Note that we don't really care about efficiency here, since this is an
531   //  edit-only ghost...
532   stream->writeAffineTransform(mObjToWorld);
533
534   return retMask;
535}
536
537void Marker::unpackUpdate(NetConnection* con, BitStream* stream)
538{
539   Parent::unpackUpdate(con, stream);
540
541   // Transform
542   MatrixF otow;
543   stream->readAffineTransform(&otow);
544
545   setTransform(otow);
546}
547