tests = null, bool bOnlySimple = true)
50 | {
51 | int N = Segments.Count;
52 | for (int i = 0; i < N; ++i) {
53 |
54 | // want to make sure we do not miss any hits, even if it means
55 | // we get duplicates...
56 | IntrSegment2Segment2 intr = new IntrSegment2Segment2(seg, Segments[i]) {
57 | IntervalThreshold = MathUtil.ZeroTolerance
58 | };
59 |
60 | if (intr.Find()) {
61 | if (bOnlySimple && intr.IsSimpleIntersection == false)
62 | continue;
63 |
64 | if (tests != null)
65 | tests.Add(intr);
66 | if (indices != null)
67 | indices.Add(i);
68 | if ( segmentTs != null ) {
69 | segmentTs.Add(intr.Parameter0);
70 | if (!intr.IsSimpleIntersection)
71 | segmentTs.Add(intr.Parameter1);
72 | }
73 |
74 | }
75 | }
76 | }
77 |
78 |
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/geometry3Sharp/spatial/SpatialFunctions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 |
5 | namespace g3
6 | {
7 |
8 | // [TODO] delete this file if nobody is using NormalOffset
9 |
10 | // collection of utility classes
11 | public static class SpatialFunctions
12 | {
13 |
14 | // various offset-surface functions, in class so the compute functions
15 | // can be passed to other functions
16 | [System.Obsolete("NormalOffset is deprecated - is anybody using it? please lmk.")]
17 | public class NormalOffset
18 | {
19 | public DMesh3 Mesh;
20 | public ISpatial Spatial;
21 |
22 | public double Distance = 0.01;
23 | public bool UseFaceNormal = true;
24 |
25 | public Vector3d FindNearestAndOffset(Vector3d pos)
26 | {
27 | int tNearestID = Spatial.FindNearestTriangle(pos);
28 | DistPoint3Triangle3 q = MeshQueries.TriangleDistance(Mesh, tNearestID, pos);
29 | Vector3d vHitNormal =
30 | (UseFaceNormal == false && Mesh.HasVertexNormals) ?
31 | Mesh.GetTriBaryNormal(tNearestID, q.TriangleBaryCoords.x, q.TriangleBaryCoords.y, q.TriangleBaryCoords.z)
32 | : Mesh.GetTriNormal(tNearestID);
33 | return q.TriangleClosest + Distance * vHitNormal;
34 | }
35 |
36 | }
37 |
38 |
39 | }
40 |
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/geometry3Sharp/spatial/SpatialInterfaces.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace g3
5 | {
6 | // [TODO] this should be called IMeshSpatial? it is specific to triangles.
7 | public interface ISpatial
8 | {
9 | bool SupportsNearestTriangle { get; }
10 |
11 | ///
12 | /// Find id of triangle nearest to p within distance fMaxDist, or return DMesh3.InvalidID if not found
13 | ///
14 | int FindNearestTriangle(Vector3d p, double fMaxDist = double.MaxValue);
15 |
16 | bool SupportsTriangleRayIntersection{ get; }
17 |
18 | ///
19 | /// Find id of triangle intersected by ray, where intersection point is within distance fMaxDist, or return DMesh3.InvalidID if not found
20 | ///
21 | int FindNearestHitTriangle(Ray3d ray, double fMaxDist = double.MaxValue);
22 |
23 | bool SupportsPointContainment { get; }
24 |
25 | ///
26 | /// return true if query point is inside mesh
27 | ///
28 | bool IsInside(Vector3d p);
29 | }
30 |
31 |
32 | public interface IProjectionTarget
33 | {
34 | Vector3d Project(Vector3d vPoint, int identifier = -1);
35 | }
36 |
37 | public interface IOrientedProjectionTarget : IProjectionTarget
38 | {
39 | Vector3d Project(Vector3d vPoint, out Vector3d vProjectNormal, int identifier = -1);
40 | }
41 |
42 | public interface IIntersectionTarget
43 | {
44 | bool HasNormal { get; }
45 | bool RayIntersect(Ray3d ray, out Vector3d vHit, out Vector3d vHitNormal);
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/help/KMPExpander.chm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PabloMK7/KMPExpander/7364324700b9ae1eac5b28406760b7c38cd710bc/help/KMPExpander.chm
--------------------------------------------------------------------------------
/help/KMPExpander.hhp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PabloMK7/KMPExpander/7364324700b9ae1eac5b28406760b7c38cd710bc/help/KMPExpander.hhp
--------------------------------------------------------------------------------
/help/Table of Contents.hhc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 | -
15 |
-
19 |
-
23 |
-
27 |
-
31 |
32 | -
36 |
-
40 |
-
44 |
45 | -
49 |
-
53 |
-
57 |
-
61 |
-
65 |
-
69 |
-
73 |
-
77 |
-
81 |
-
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/help/htm/DIV_File.htm:
--------------------------------------------------------------------------------
1 | DIV Files
2 | DIV Files are used for rendering. This section is still being written and will be added to the next KMP Expander release.
--------------------------------------------------------------------------------
/help/htm/File_types.htm:
--------------------------------------------------------------------------------
1 | File Types
2 | KMP Expander supports the following file formats:
3 |
4 | - Editing Mario Kart 7 KMP files.
5 | - Creating new Mario Kart 7 DIV files as well as a working BCMDL file from a CMDL that will be linked to the DIV file properly.
6 | - Editing Mario Kart 7 UIMapPos.bin files.
7 |
--------------------------------------------------------------------------------
/help/htm/KMP/camera_settings.htm:
--------------------------------------------------------------------------------
1 | Camera Settings
2 | Camera settings related help is still being developed, will be added in the next KMP Expander release.
--------------------------------------------------------------------------------
/help/htm/KMP/glider_routes.htm:
--------------------------------------------------------------------------------
1 | Glider Routes
2 | Glider routes are used in glide sections. They dictate the path karts should follow when gliding and prevent them from getting too far from the route. Glider routes are applied to CPU racers and the human player.
3 | Group Settings
4 | Group settings are displayed in the Group Settings view:
5 |
6 | - Next: Lists all the possible groups that gliding karts can go to after finishing this one. One of these groups will be taken randomly. There can be up to 6 next groups, unused entries in the next list should be set to -1.
7 | - Previous: Lists all the possible groups that gliding karts could have come from. IMPORTANT: if group X has group Y in the next list, group Y has group X in the previous list, otherwise the game may crash. There can be up to 6 previous groups, unused entries in the previous list should be set to -1.
8 | - Unknown2: The purpose of this field is unknown, normally 0.
9 | - CannonSection: The group acts as a cannon route. If this flag is set to True, ForceToRoute must be also set to True.
10 | - ForceToRoute: Karts are forced to follow the route and can't leave it, they are also forced to land when the route finishes. Otherwise they can continue flying.
11 | - PreventRaising: Karts can only fly forwards or downwards, so after they have descended they are not able to ascend again.
12 |
13 | Normally Next and Previous are never used in original tracks as there is only one group per gliding section.
14 | Parameters
15 | Parameters are displayed in the entry list:
16 |
17 | - PositionXYZ: Position of the Glider Point.
18 | - Scale: Scale of the glider point. This is represented as a circle in the editor, karts are able to move within this circle. (Note that ingame, they are not circles but spheres).
19 | - Unknown1/2: The purpose of these parameters are unknown, normally 0.
20 |
21 | Tips
22 |
23 | - Make sure that if group X has group Y in the next list, group Y has group X in the previous list, otherwise the game may crash.
24 | - Make sure all the glider points are inside the checkpoints, otherwise the game will crash.
25 | - Make sure all the glider points are avobe Y=0 (failsafe death barrier), otherwise the game may crash.
26 | - It is recommended to set the ForceToRoute flag to True so karts will follow the route more precisely.
27 |
--------------------------------------------------------------------------------
/help/htm/KMP/item_points.htm:
--------------------------------------------------------------------------------
1 | Item Routes
2 | Item routes are used by red shells and blue shells to know where to go in tracks. Each route group is linked to other groups via its group settings and each point of the group has its own flags and parameters.
3 | Group Settings
4 | Group settings are displayed in the Group Settings view:
5 |
6 | - Next: Lists all the possible groups that items can go to after finishing this one. One of these groups will be taken randomly. There can be up to 6 next groups, unused entries in the next list should be set to -1.
7 | - Previous: Lists all the possible groups that items could have come from. IMPORTANT: if group X has group Y in the next list, group Y has group X in the previous list, otherwise the game may crash. There can be up to 6 previous groups, unused entries in the previous list should be set to -1.
8 |
9 | Parameters
10 | Parameters are displayed in the entry list:
11 |
12 | - PositionXYZ: Position of the Item Point.
13 | - Scale: Scale of the item point. This is represented as a circle in the editor, shells will choose a point on each item entry within this circle to go to, so make sure that the whole circle is inside the road. (Note that ingame, they are not circles but spheres).
14 | - GravityMode: Controls how gravity affect shells:
15 |
16 | - 0 - Affected by Gravity: Items will fall to the ground. (Default)
17 | - 1 - Unaffected By Gravity: Items will fly to follow the route. (Used in places where there is no ground and items should fly, such as gliding sections or big jumps.)
18 | - 2 - Cannon Section: Same as Unaffected By Gravity but items will fly faster. (Used in cannon sections.)
19 |
20 |
21 | - PlayerScanRadius: Controls the scan radius of shells to target players. The scan radius is shown in the editor as a dashed circle:
22 |
23 | - 0 - Small: Small radius of 300 units. (Default)
24 | - 1 - Big: Big radius of 900 units. (Used in wide sections)
25 |
26 |
27 |
28 | Tips
29 |
30 | - Make sure that if group X has group Y in the next list, group Y has group X in the previous list, otherwise the game may crash.
31 | - Make sure all the item points are inside the checkpoints, otherwise the game will crash.
32 | - Make sure all the item points are above Y=0 (failsafe death barrier), otherwise the game may crash.
33 | - If shells fall or crash on walls because they can't make a jump, remember to set GravityMode to 1. Remember to set the value to 2 in cannon sections.
34 | - Only use the Big value of PlayerScanRadius if it's needed to scan a larger area, otherwise use Small.
35 |
--------------------------------------------------------------------------------
/help/htm/KMP/respawn_points.htm:
--------------------------------------------------------------------------------
1 | Respawn Points
2 | Respawn points are used to respawn karts and blue shells when they go through a fall boundary. Respawn points are linked to checkpoints by the checkpoint RespawnID parameter.
3 | Parameters
4 | Parameters are displayed in the entry list:
5 |
6 | - PositionXYZ: Position of the respawn point.
7 | - RotationXYZ: Rotation of the respawn point. The direction of the respawn point is shown in the editor (based of the RotationY value).
8 | - Unknown: The purpose of this parameter is unknown, normally FFFF.
9 |
10 | Tips
11 |
12 | - You can create as many respawn points as the number of checkpoints. It is recommended to space the respawn points so there aren't any large sections of the track without them, even if it is not possible to fall, just in case.
13 | - Make sure you set the RotationY of the point properly. Use the line shown in the editor to check the direction.
14 | - Keep in mind that after a CPU Racer respawns, they will search for the closest Enemy Point to their respawn point to follow.
15 |
--------------------------------------------------------------------------------
/help/htm/KMP/routes.htm:
--------------------------------------------------------------------------------
1 | Routes
2 | Routes are general purpose paths used with other KMP Sections.
3 | Group Settings
4 | Group settings are displayed in the Group Settings view:
5 |
6 | - Loop: Defines if the route is looped. If set to True, whatever thing is linked to the route will go to the first point after finishing the last one.
7 | - Smooth: Defines if the route path is smoothen. Recommended for opening cameras.
8 |
9 | Parameters
10 | Parameters are displayed in the entry list:
11 |
12 | - PositionXYZ: Position of the Enemy Point.
13 | - Speed: The speed of the route. This parameter is not used by some Objects (one of the Settings of the object is used instead). Route speed is interpolated between points, so if you don't want whatever thing is linked to the route to never finish the route, set the last point speed to 0.
14 | - Setting2: Used by some Objects, its meaning is ObjectType specific. (Default value is 0).
15 |
16 | Tips
17 |
18 | - Since Routes are for general purpose, there are no Route specific tips.
19 |
--------------------------------------------------------------------------------
/help/htm/KMP/start_positions.htm:
--------------------------------------------------------------------------------
1 | Start Positions
2 | Start Positions are only used in battle tracks so in normal tracks, this section is empty. There has to be 8 different start positions in battle tracks, otherwise, the game will crash. Once the battle starts, each player will be placed in one of the start positions randomly.
3 | Parameters
4 |
5 | - PositionXYZ: Position of the point.
6 | - RotationXYZ: Rotation of the point (RotationY is the most useful one, represented by a line in the editor).
7 |
--------------------------------------------------------------------------------
/help/htm/KMP_expander.htm:
--------------------------------------------------------------------------------
1 | KMP Expander
2 | KMP Expander is a tool that allows the editing of several Mario Kart 7 track files.
3 | You will find information about each file format in this manual as well as some tips about KMP stuff.
4 | To open, save and close KMP, UIMapPos and DIV files, use the File menu.
5 | NOTE: This manual is not final, some sections are missing or may be wrong.
--------------------------------------------------------------------------------
/help/htm/OBJ_Manager.htm:
--------------------------------------------------------------------------------
1 | OBJ Manager
2 | KMP Expander allows to open a Wavefront .obj file which will be displayed in the editor below the kmp data. This helps having a perspective on how the kmp data will be positioned in the track. Furthermore, by right clicking on compatible entry points, its Y coordinate will be calculated automatically.
3 | OBJ Manager Window
4 | The OBJ manager window can be opened by clicking OBJ Manager under the Tools menu.
5 |
6 | - Load OBJ: Opens an .obj file.
7 | - Close OBJ: Closes the currently loaded .obj file.
8 | - Render OBJ: Enables/Disables OBJ rendering in the editor.
9 | - Wireframe: Only the lines connecting vertices will be displayed instead of the full model. This is useful to know which triangles will be affected by DIV boxes.
10 | - Material: Selects a material from the .obj
11 | - Material Settings: Allows to change some settings from the current selected material. (Description about each parameter can be found below the Material Settings view).
12 |
13 | Tips
14 |
15 | - If your model shows completely black, make sure the texture is showing correctly in the texture view and that the diffuse color is not black.
16 |
--------------------------------------------------------------------------------
/help/htm/Options.htm:
--------------------------------------------------------------------------------
1 | Options
2 | KMP Expander options can be changed under the Tools menu. From the options you can change several editor settings such as point colors and sizes. (See the settings menu for a description of each setting.)
--------------------------------------------------------------------------------
/help/htm/UIMapPos.htm:
--------------------------------------------------------------------------------
1 | UIMapPos
2 | The UIMapPos file controls how the local and global minimaps are placed in the bottom screen ingame. To open, save and close UIMapPos files, go to the File menu. KMP expander only allows to edit local minimap position as how the global minimap coordinates are handled is unknown.
3 | From the Tools->UIMapPos menu you can load an image to the local map box shown in the editor as well as toggle its view.
4 | Local Minimap
5 | The local minimap will be displayed in the editor as a black box with two black points on two of its corners. You can move those points to adjust the size of the black box so it matches the 3D model properly.
6 | Tips
7 | If you load a minimap image, you won't be able to see the OBJ model as it is covered by the image itself. However, you can open the minimap image with an image editor and change its transparency. That way the transparency will also be applied in the editor and you will be able to see the OBJ model through the minimap.
--------------------------------------------------------------------------------
/help/htm/User Interface.htm:
--------------------------------------------------------------------------------
1 | User Interface
2 | KMP Expander is divided in four sections:
3 |
4 | - Tree View (Top Left): From the tree view you can select which KMP/DIV section or section group is loaded to the entry list and group settings view. By right clicking on compatible section groups you will be able to add new groups or remove existing ones. By checking or unchecking the checkbox, that specific section/group will be hidden in the editor.
5 | - Group Settings (Botom Left): Allows to change the settings for the current selected group (see section specific help for details).
6 | - Entry List (Bottom Right): Displays all the entries of the current selected section/group. You can also edit individual parameters for each entry (see section specific help for details). There are several controls in the top part of the entry list:
7 |
8 | - Add Entry (+): Adds a new entry below the selected one with default parameters.
9 | - Remove Entry (-): Removes the current selected entry.
10 | - Shift Up/Down (^,v): Moves up or down in the list the current selected entry.
11 | - Toggle Draw Mode (ItemBox with cursor): With draw mode enabled, clicking on the editor will place a new point where the cursor is instead of selecting/moving existing points. Click again to disable.
12 | - Change View Plane: Changes the camera position in the Editor:
13 |
14 | - XZ: Top to bottom.
15 | - XY: Back to front.
16 | - ZY: Left to right.
17 |
18 |
19 | - Play Intro Cameras: (Camera):Plays the track intro cameras. Press the Escape key to stop.
20 |
21 |
22 | - Editor (Top Right): This is where all the visible section points will be displayed as well as the UIMapPos image, DIV boxes and loaded OBJ. You can use the editor to move existing points or place new ones with the Draw Mode enabled by left clicking. If an OBJ is loaded, right clicking on a point will calculate its Y position based on the OBJ geometry.
23 |
--------------------------------------------------------------------------------
/help/htm/kmp_file.htm:
--------------------------------------------------------------------------------
1 | KMP File
2 | KMP files contain all the information about Mario Kart 7 tracks that isn't collission or scenary, this includes item boxes, coins, enemy paths, etc. You can use this tool to edit all of these parameters that can be found in the file:
3 |
4 | - Start Positions
5 | - Enemy Routes
6 | - Item Routes
7 | - Glider Routes
8 | - Checkpoints
9 | - Respawn Points
10 | - Objects
11 | - Routes
12 | - Areas
13 | - Cameras
14 |
15 | You can find information about those parameters in their respective help pages.
--------------------------------------------------------------------------------