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
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-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

  • Ffp samples available in UNIGINE SDK Browser for C++ and C# APIs.

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.

int COLOR_BLACK

Description

Black color value: 0xff000000u

int COLOR_BLUE

Description

Blue color value: 0xff0000ffu

int COLOR_GREEN

Description

Blue color value: 0xff00ff00u

int COLOR_RED

Description

Blue color value: 0xffff0000u

int COLOR_WHITE

Description

Blue color value: 0xffffffffu

int MODE_CUBE

Description

Cubemap rendering mode.

int MODE_DEFAULT

Description

Default rendering mode.

int MODE_GRAD

Description

Gradient rendering mode.

int MODE_MULTISAMPLE_16

Description

Multisampling (x16) rendering mode.

int MODE_MULTISAMPLE_2

Description

Multisampling (x2) rendering mode.

int MODE_MULTISAMPLE_4

Description

Multisampling (x4) rendering mode.

int MODE_MULTISAMPLE_8

Description

Multisampling (x8) rendering mode.

int MODE_SHADOW

Description

Shadow rendering mode.

int MODE_SOLID

Description

Solid rendering mode.

int MODE_SPLASH

Description

Splash screen rendering mode.

int MODE_SRGB

Description

SRGB correction rendering mode.

int MODE_YUV

Description

YUV rendering mode.

int MODE_INTEGER

Description

Integer texture rendering mode.

int MODE_ARRAY

Description

Texture array rendering mode.

int MODE_POLYGON_OFFSET

Description

Polygon offset rendering mode.
Last update: 10.08.2018
Build: ()