This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::Ffp Class

Header: #include <UnigineFfp.h>

Interface for fixed function pipeline.

Ffp class in Unigine differs from the classic OpenGL FFP implementation. For example, Unigine Visualizer and Texture Buffers for Debugging are implemented by using Ffp. Ffp uses already implemented OpenGL and D3D11 shader programs (without creating materials, etc.) to render.

This interface enables to render basic geometric primitives. For example, it can be used to draw a project watermark.

Usage Example

Here is an example how to render 2D texture:

Source code (C++)
/* ... */
// get the Ffp instance
Ffp *ffp = Ffp::get();
// begin triangles rendering
ffp->beginTriangles();
	// add single triangle quad
	// this method creates indices
	ffp->addTriangleQuads(1);
	// add 4 vertices and texcoords
	ffp->addVertex(x0,y0);
	ffp->setTexCoord(0.0f,0.0f);
	ffp->addVertex(x1,y0);
	ffp->setTexCoord(1.0f,0.0f);
	ffp->addVertex(x1,y1);
	ffp->setTexCoord(1.0f,1.0f);
	ffp->addVertex(x0,y1);
	ffp->setTexCoord(0.0f,1.0f);
// end of triangles rendering
ffp->endTriangles();

See Also

  • C++ API sample located in the folder <UnigineSDK>/source/samples/Api/Systems/Ffp
  • C# API sample located in the folder <UnigineSDK>/source/csharp/samples/Api/Systems/Ffp

Ffp Class

Members


Ffp * get ( ) #

Returns the pointer to the current Ffp class instance.

Return value

Pointer to the Ffp class instance.

void setColor ( unsigned int color ) #

Sets rendering color for the last added vertex.

You can use COLOR_* variables to set the color.

Arguments

  • unsigned int color - Color in ARGB8 format: (a << 24) | (r << 16) | (g << 8) | (b << 0).

void setColor ( float r, float g, float b, float a ) #

Sets rendering color for the last added vertex.

Arguments

  • float r - Red color component.
  • float g - Green color component.
  • float b - Blue color component.
  • float a - Alpha color component.

int isEnabled ( ) #

Return a value indicating if the Ffp is enabled.

Return value

Returns 1 if the Ffp is enabled; otherwise, 0.

void setMode ( int mode ) #

Sets current Ffp mode.

Arguments

  • int mode - Current Ffp mode.

int getMode ( ) #

Returns current Ffp mode.

Return value

Current Ffp mode.

int getNumIndices ( ) #

Returns the number of indices in the current primitive batch.

Return value

The number of indices.

int getNumVertex ( ) #

Returns the number of vertices in the current primitive batch.

Return value

The number of vertices.

void setOrtho ( int width, int height ) #

Sets orthographic projection to render the primitive.

For example, the render_show_textures console command renders textures via Ffp by using orthographic projection.

Arguments

  • int width - Primitive width.
  • int height - Primitive height.

void setTexCoord ( float x, float y, float z = 0.0f, float w = 1.0f ) #

Sets texture coordinates for the last added vertex.

Arguments

  • float x - X texture coordinate.
  • float y - Y texture coordinate.
  • float z - Z texture coordinate.
  • float w - W texture coordinate.

void setTransform ( const Math::mat4 & transform ) #

Sets transformation matrix for the rendered primitive.

Arguments

  • const Math::mat4 & transform - Transformation matrix.

Math::mat4 getTransform ( ) #

Returns transformation matrix of the rendered primitive.

Return value

Transformation matrix.

void addIndex ( int index ) #

Adds given index to Ffp.

Arguments

  • int index - Index of a vertex.

void addIndices ( int i0, int i1 ) #

Adds two given indices to Ffp.

Arguments

  • int i0 - The first index.
  • int i1 - The second index.

void addIndices ( ushort[] indices, int vertex_offset ) #

Adds given indices array to Ffp with given vertex offset.

Arguments

  • ushort[] indices - The first index.
  • int vertex_offset - Vertex offset.

void addIndices ( ushort[] indices ) #

Adds given indecis array to Ffp.

Arguments

  • ushort[] indices

void addIndices ( int i0, int i1, int i2, int i3 ) #

Adds four given indices to Ffp.

Arguments

  • int i0 - The first index.
  • int i1 - The second index.
  • int i2 - The third index.
  • int i3 - The fourth index.

void addIndices ( int i0, int i1, int i2 ) #

Adds three given indices to Ffp.

Arguments

  • int i0 - The first index.
  • int i1 - The second index.
  • int i2 - The third index.

void addLines ( int num ) #

Adds a specified number of lines.

This method does not add vertices; instead, it allocates indices, for which vertices should be then created with addVertex(). Indices will point to vertices starting from the last added vertex.

Arguments

  • int num - The number of lines.

void addTriangleQuads ( int num ) #

Adds a specified number of quads. This method does not add vertices; instead, it allocates indices, for which vertices should be then created with addVertex(). Indices will point to vertices starting from the last added vertex.

Arguments

  • int num - The number of quads.

void addTriangles ( int num ) #

Adds a specified number of triangles. This method does not add vertices; instead, it allocates indices, for which vertices should be then created with addVertex(). Indices will point to vertices starting from the last added vertex.

Arguments

  • int num - The number of triangles.

void addVertex ( const Ffp::Vertex[] & vertex ) #

Adds given vertex array to Ffp.

Arguments

  • const Ffp::Vertex[] & vertex - Vertex.

void addVertex ( const Ffp::Vertex & vertex ) #

Adds given vertex to Ffp.

Arguments

  • const Ffp::Vertex & vertex - Vertex.

void addVertex ( float x, float y, float z = 0.0f ) #

Adds a vertex with given coordinates to Ffp.

Arguments

  • float x - X coordinate of the vertex.
  • float y - Y coordinate of the vertex.
  • float z - Z coordinate of the vertex.

void beginLines ( ) #

Begins rendering of lines. Specify a list of vertex or index data between beginLines() and endLines().

void beginTriangles ( ) #

Begins rendering of triangles. Specify a list of primitives and vertex data between beginTriangles() and endTriangles().

void disable ( ) #

Disables Ffp rendering.

void enable ( int mode = MODE_DEFAULT ) #

Enables Ffp rendering.

Arguments

  • int mode - Ffp mode.

void endLines ( ) #

Ends rendering of lines (i.e. draws the specified lines).

void endTriangles ( ) #

Ends rendering of triangles (i.e. draws the specified triangles).

void renderScreen ( ) #

Renderers a full screen quad. It should be used when rendering post effects.
Last update: 2019-08-16
Build: ()