Back to main page

Back to parent interface

Model_Part

Go to vertice child interface

int Model_Part_Triangle_CreateCopy(int SourceModel, int SourcePartIndex, int SourceTriangleIndex, int DestModel, int DestPartIndex);

Vertex selection data is duplicated with this method.

SourceModel and DestModel are valid models. SourcePartIndex is a valid part index in SourceModel. DestPartIndex is a valid part index in DestModel. SourceTriangleIndex is a valid triangle index in SourceModel at SourcePartIndex.

Returns the new triangle index in DestModel at DestPartIndex as a copy of the triangle in SourceModel at SourcePartIndex at SourceTriangleIndex. -1 is returned if a precondition is broken.

Creates a copy of the triangle from SourceModel at SourcePartIndex at SourceTriangleIndex.

int Model_Part_Create_InSB(int Model, int PreallocatedTriangleCount);

Model is a valid model, 0 < PreallocatedTriangleCount and the part's name in the string buffer is a "SimpleString" in model format specification. If PreallocatedTriangleCount is too low, it will be set to 1 and continue without a warning.

Returns the local index to the new part created in Model. -1 is returned if the precondition is broken.

Creates a new part in Model with memory preallocated for PreallocatedTriangleCount number of triangles.

void Model_Part_Delete(int Model, int PartIndex);

Removing a part that is not the last one places the last part at the removed part's old index. Make safe removal of parts by looping backwards.

Model is a valid model and 0 ≤ PartIndex < number of parts in Model.

Removes the part at PartIndex in Model. Fills the hole with the last part.

void Model_Part_Delete_PreserveOrder(int Model, int PartIndex);

Like Model_Part_Delete but with preserved order and therefor a slower worst case time complexity.

Removing a part that is not the last one moves all parts after it to fill the gap with preserved order. Make safe removal of parts by looping backwards.

Model is a valid model and 0 ≤ PartIndex < number of parts in Model.

Removes the part at PartIndex in Model. Moves every following part one index down to fill the hole.

void Model_Part_SwapRenderingOrder(int Model, int PartIndexA, int PartIndexB);

Swaps the parts at index PartIndexA and PartIndexB. The parts in a model are rendered from index 0 and up. Changing the order will therefor affect performance and alpha filter overlapping.

Model is a valid model, 0 ≤ PartIndexA < number of parts in Model and 0 ≤ PartIndexB < number of parts in Model.

Swaps the parts at index PartIndexA and PartIndexB in Model.

int Model_Part_InsertTriangle(int Model, int PartIndex);

The number of triangles in one part may not exceed 1000000, Model is a valid model and 0 ≤ PartIndex < number of parts in Model.

The local triangle index in the part at PartIndex in Model. -1 is returned if the precondition is broken.

Inserts a triangle to the part at PartIndex in Model using the following default values for each vertice.

Pos = (0,0,0)

TexCoord = (0,0,0,0)

Color = (1,1,1,1)

Normal = (0,0,0)

A = (0,0,0,0)

B = (0,0,0,0)

void Model_Part_DeleteTriangle(int Model, int PartIndex, int TriangleIndex);

This method works like Model_Part_Delete but with triangles and have the same dangers.

Model is a model, 0 ≤ PartIndex < (number of parts in Model) and 0 ≤ TriangleIndex < (number of triangles in Model's part at PartIndex).

Removes the triangle at TriangleIndex in Model's part at PartIndex. Fills the hole with the last triangle.

void Model_Part_DeleteTriangle_PreserveOrder(int Model, int PartIndex, int TriangleIndex);

Like Model_Part_DeleteTriangle but with preserved order and therefor a slower worst case time complexity.

This method works like Model_Part_Delete_PreserveOrder but with triangles and have the same dangers.

Model is a model, 0 ≤ PartIndex < (number of parts in Model) and 0 ≤ TriangleIndex < (number of triangles in Model's part at PartIndex).

Removes the triangle at TriangleIndex in Model's part at PartIndex. Moves every following triangle one index down to fill the hole.

void Model_Part_SwapTriangleRenderingOrder(int Model, int PartIndex, int TriangleIndexA, int TriangleIndexB);

Model is a model, 0 ≤ PartIndex < (number of parts in Model), 0 ≤ TriangleIndexA < (number of triangles in Model's part at PartIndex) and 0 ≤ TriangleIndexB < (number of triangles in Model's part at PartIndex).

Swaps the triangles at index TriangleIndexA and TriangleIndexB in Model's part at PartIndex.

void Model_Part_Triangle_Flip(int Model, int PartIndex, int TriangleIndex);

Model is a model, 0 ≤ PartIndex < (number of parts in Model), 0 ≤ TriangleIndex < (number of triangles in Model's part at PartIndex).

Flips the triangle at TriangleIndex in Model's part at PartIndex. This is done by swapping place between vertice 0 and 2.

void Model_Part_SetTexture(int Model, int PartIndex, int TextureChannel, int Texture);

Draw surfaces can't be used as textures in the model because that would make it impossible to save the model to a file.

Model is a valid model, 0 ≤ PartIndex < number of parts in Model, 0 ≤ TextureChannel ≤ 15 and Texture is a valid Texture or 0 for no texture.

Gives Texture to part number PartIndex in Model at TextureChannel.

int Model_Part_GetTexture(int Model, int PartIndex, int TextureChannel);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model and 0 ≤ TextureChannel ≤ 15.

A texture reference to the texture in part number PartIndex in Model at TextureChannel. If the precondition is broken, -1 is returned.

void Model_Part_SetTexture_ByName_InSB(int Model, int PartIndex,int TextureChannel);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model, 0 ≤ TextureChannel ≤ 15 and the string buffer contain the texture's extensionless filename with less than 260 characters or "" for no texture.

Gives a texture loaded with a filename from the string buffer to part number PartIndex in Model at TextureChannel.

void Model_Part_GetTextureName_OutSB(int Model, int PartIndex, int TextureChannel);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model and 0 ≤ TextureChannel ≤ 15.

The string buffer is filled with the extensionless filname of the texture in part number PartIndex in Model at TextureChannel.

void Model_Part_SetTextureOverride(int Model, int PartIndex, int TextureChannel, int OverrideChannel);

The texture override channel can be assigned to a texture slot to allow the model's instances to use another texture or draw surface. This allow using the same model with many different textures and can even use a dynamic draw surface.

Model is a valid model, 0 ≤ PartIndex < number of parts in Model, 0 ≤ TextureChannel ≤ 15 and -1 ≤ OverrideChannel ≤ 15.

The part number PartIndex in Model at TextureChannel will allow overriding the texture with an instance texture at channel OverrideChannel. If OverrideChannel = -1 then no overriding is allowed from the instance.

int Model_Part_GetTextureOverride(int Model, int PartIndex, int TextureChannel);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model and 0 ≤ TextureChannel ≤ 15.

Returns the part's override channel at TextureChannel.

void Model_Part_SetMinDetailLevel(int Model, int PartIndex, int DetailLevel);

The minimum detail level is the lowest detail level that the part is visible in.

Model is a valid model, 0 ≤ PartIndex < number of parts in Model and 0 ≤ DetailLevel ≤ 2.

The minimum detail level at part number PartIndex in Model is set to DetailLevel.

int Model_Part_GetMinDetailLevel(int Model, int PartIndex);

Model is a valid model and 0 ≤ PartIndex < number of parts in Model.

Returns the part's minimum detail level that it is visible in.

void Model_Part_SetMaxDetailLevel(int Model, int PartIndex, int DetailLevel);

The maximum detail level is the highest detail level that the part is visible in.

Model is a valid model, 0 ≤ PartIndex < number of parts in Model and 0 ≤ DetailLevel ≤ 2.

The maximum detail level at part number PartIndex in Model is set to DetailLevel.

int Model_Part_GetMaxDetailLevel(int Model, int PartIndex);

Model is a valid model and 0 ≤ PartIndex < number of parts in Model.

Returns the part's maximum detail level that it is visible in.

void Model_Part_SetShader(int Model, int PartIndex, int ShaderChannel, int MaterialShader);

ShaderChannel is the index given when rendering the scene. It is used for rendering shadows, infra red vision and other things that you might need it for. The default shaders should be placed at index 0.

Model is a valid model, 0 ≤ PartIndex < number of parts in Model, 0 ≤ ShaderChannel ≤ 15 and MaterialShader is a shader loaded as a material shader or 0 for no shader.

Gives MaterialShader to part number PartIndex in Model at ShaderChannel.

int Model_Part_GetShader(int Model, int PartIndex, int ShaderChannel);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model and 0 ≤ ShaderChannel ≤ 15.

A shader reference to the shader in part number PartIndex in Model at ShaderChannel. If the precondition is broken, -1 is returned.

void Model_Part_SetShader_ByName_InSB(int Model, int PartIndex,int ShaderChannel);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model, 0 ≤ ShaderChannel ≤ 15 and the string buffer contain the shader's extensionless filename with less than 260 characters or "" for no shader.

Gives a shader loaded with a filename from the string buffer to part number PartIndex in Model at ShaderChannel.

void Model_Part_GetShaderName_OutSB(int Model, int PartIndex, int ShaderChannel);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model and 0 ≤ ShaderChannel ≤ 15.

The string buffer is filled with the extensionless filname of the shader in part number PartIndex in Model at ShaderChannel.

int Model_GetNumberOfParts(int Model);

Model is a valid model.

Returns the number of parts in model. -1 is returned if the precondition is broken.

void Model_Part_SetName_InSB(int Model, int PartIndex);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model, the string buffer contains the name that you want to rename the part with.

Sets the name of the part at PartIndex in Model to the content in the string buffer.

void Model_Part_GetName_OutSB(int Model, int PartIndex);

Model is a valid model, 0 ≤ PartIndex < number of parts in Model.

Writes the name of the part at PartIndex in Model to the string buffer.

int Model_Part_GetTriangleCount(int Model, int PartIndex);

Model is a valid model and 0 ≤ PartIndex < number of parts in Model.

Returns the number of triangles in the part at PartIndex in Model. -1 is returned if the precondition is broken.