Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fbf3428
Checks to report fatal error if FontConfig is not available
9prady9 Sep 20, 2016
c9acbf1
Merge pull request #116 from 9prady9/fontconfig_cmake_fixes
shehzan10 Sep 20, 2016
773cbb4
Remove FG_COMPILE_LINK_ERROR macro is shader program link is successful
shehzan10 Oct 19, 2016
9a11946
Merge pull request #119 from shehzan10/devel
9prady9 Oct 20, 2016
aee4bd4
Add function to get chart axes limits
shehzan10 Oct 31, 2016
5feb0c8
Set axes limits to 0 as default
shehzan10 Nov 1, 2016
d019c61
Increment version to 0.9.1
shehzan10 Nov 1, 2016
bad89ce
Merge pull request #120 from shehzan10/devel
9prady9 Nov 3, 2016
d7750b0
fix bearing variable type to handle negative values
9prady9 Nov 10, 2016
b80fa81
fix string offset values to signed type(int) for font
9prady9 Nov 10, 2016
05c9675
Correct visual spectrum color map values
9prady9 Nov 19, 2016
b0ea574
New colormaps: inferno, magma, plasma and viridis
9prady9 Nov 19, 2016
397b5dc
Fix color maps: heat, blue and rainbow(known as colors earlier)
9prady9 Nov 20, 2016
f41f04d
Correct color map documentation
9prady9 Nov 20, 2016
98eeac8
fix warnings in colormap_impl class
9prady9 Nov 20, 2016
a405c42
Fix build of examples with the system cl2hpp.
ghisvail Dec 6, 2016
2e8da87
Merge pull request #123 from 9prady9/colormap_fixes
shehzan10 Dec 6, 2016
f073247
Merge pull request #124 from ghisvail/master
shehzan10 Dec 6, 2016
911fd6c
fix indentation in surface impl file
9prady9 Dec 6, 2016
4df785c
fix index buffer for surface's triangular strip
9prady9 Dec 7, 2016
a23f095
fix index buffer type in surface
9prady9 Dec 9, 2016
4aa16cc
fix style in surface example
9prady9 Dec 19, 2016
de4968a
reserve vector memory for surface's index buffer
9prady9 Dec 19, 2016
7d045e4
fix function signature style
9prady9 Dec 19, 2016
c57384d
bump version to 0.9.2
9prady9 Dec 19, 2016
175a6b2
Merge pull request #125 from 9prady9/surface_fixes
shehzan10 Dec 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions CMakeModules/FindFontConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

if ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
IF ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
# in cache already
SET(Fontconfig_FIND_QUIETLY TRUE)
endif ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )
ENDIF ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY )

# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if(NOT WIN32)
find_package(PkgConfig)
IF (NOT WIN32)
FIND_PACKAGE(PkgConfig)

pkg_check_modules(FONTCONFIG_PKG QUIET fontconfig)
endif(NOT WIN32)
ENDIF (NOT WIN32)

FIND_PATH(FONTCONFIG_INCLUDE_DIR NAMES fontconfig/fontconfig.h
PATHS
Expand All @@ -32,6 +32,10 @@ FIND_PATH(FONTCONFIG_INCLUDE_DIR NAMES fontconfig/fontconfig.h
${FONTCONFIG_PKG_INCLUDE_DIRS} # Generated by pkg-config
)

IF (DEFINED FONTCONFIG_INCLUDE_DIR-NOTFOUND)
MESSAGE(FATAL_ERROR "FontConfig header files not found")
ENDIF (DEFINED FONTCONFIG_INCLUDE_DIR-NOTFOUND)

FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig ${FONTCONFIG_PKG_LIBRARY}
PATHS
/usr/local
Expand All @@ -44,7 +48,11 @@ FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig ${FONTCONFIG_PKG_LIBRARY}
lib
)

include(FindPackageHandleStandardArgs)
IF (DEFINED FONTCONFIG_LIBRARY-NOTFOUND)
MESSAGE(FATAL_ERROR "FontConfig library files not found")
ENDIF (DEFINED FONTCONFIG_LIBRARY-NOTFOUND)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)

# show the FONTCONFIG_INCLUDE_DIR and FONTCONFIG_LIBRARY variables only in the advanced view
Expand Down
2 changes: 1 addition & 1 deletion CMakeModules/Version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ENDIF()

SET(FG_VERSION_MAJOR "0")
SET(FG_VERSION_MINOR "9")
SET(FG_VERSION_PATCH "0")
SET(FG_VERSION_PATCH "2")

SET(FG_VERSION "${FG_VERSION_MAJOR}.${FG_VERSION_MINOR}.${FG_VERSION_PATCH}")
SET(FG_API_VERSION_CURRENT ${FG_VERSION_MAJOR}${FG_VERSION_MINOR})
Expand Down
Binary file removed docs/images/gfx_palette.png
Binary file not shown.
8 changes: 6 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ OPTION(BUILD_EXAMPLES_CUDA "Turn off/on building cuda examples" ON)
OPTION(BUILD_EXAMPLES_OPENCL "Turn off/on building opencl examples" ON)
OPTION(USE_SYSTEM_CL2HPP "Use cl2.hpp header installed on the system" OFF)

INCLUDE(build_cl2hpp)
IF(NOT USE_SYSTEM_CL2HPP)
INCLUDE(build_cl2hpp)
ENDIF()

MACRO(BUILD_EXAMPLE EX_NAME EX_SRC COMPUTE_NAME FG_LIBS COMPUTE_LIBS)
IF(${COMPUTE_NAME} STREQUAL "cuda")
Expand All @@ -22,7 +24,9 @@ MACRO(BUILD_EXAMPLE EX_NAME EX_SRC COMPUTE_NAME FG_LIBS COMPUTE_LIBS)
RUNTIME_OUTPUT_DIRECTORY ${DIR_NAME}
FOLDER "Examples/${COMPUTE_NAME}")
IF(${COMPUTE_NAME} STREQUAL "opencl")
ADD_DEPENDENCIES(example_${EX_NAME}_${COMPUTE_NAME} cl2hpp)
IF(NOT USE_SYSTEM_CL2HPP)
ADD_DEPENDENCIES(example_${EX_NAME}_${COMPUTE_NAME} cl2hpp)
ENDIF()
ENDIF()
ENDMACRO()

Expand Down
16 changes: 8 additions & 8 deletions examples/cpu/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@

using namespace std;

static const float XMIN = -8.0f;
static const float XMAX = 8.f;
static const float YMIN = -8.0f;
static const float YMAX = 8.f;
static const float XMIN = -32.0f;
static const float XMAX = 32.0f;
static const float YMIN = -32.0f;
static const float YMAX = 32.0f;

const float DX = 0.5;
const float DX = 0.25;
const size_t XSIZE = (XMAX-XMIN)/DX;
const size_t YSIZE = (YMAX-YMIN)/DX;

void genSurface(float dx, std::vector<float> &vec )
{
vec.clear();
for(float x=XMIN; x < XMAX; x+=dx){
for(float y=YMIN; y < YMAX; y+=dx){
for(float x=XMIN; x < XMAX; x+=dx) {
for(float y=YMIN; y < YMAX; y+=dx) {
vec.push_back(x);
vec.push_back(y);
float z = sqrt(x*x+y*y) + 2.2204e-16;
Expand All @@ -50,7 +50,7 @@ int main(void)
wnd.makeCurrent();

forge::Chart chart(FG_CHART_3D);
chart.setAxesLimits(-10.f, 10.f, -10.f, 10.f, -0.5f, 1.f);
chart.setAxesLimits(XMIN-2.0f, XMAX+2.0f, YMIN-2.0f, YMAX+2.0f, -0.5f, 1.f);
chart.setAxesTitles("x-axis", "y-axis", "z-axis");

forge::Surface surf = chart.surface(XSIZE, YSIZE, forge::f32);
Expand Down
33 changes: 32 additions & 1 deletion include/fg/chart.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ FGAPI fg_err fg_set_chart_axes_limits(fg_chart pHandle,
const float pYmin, const float pYmax,
const float pZmin, const float pZmax);

/**
Get axes data ranges

\param[out] pXmin is x-axis minimum data value
\param[out] pXmax is x-axis maximum data value
\param[out] pYmin is y-axis minimum data value
\param[out] pYmax is y-axis maximum data value
\param[out] pZmin is z-axis minimum data value
\param[out] pZmax is z-axis maximum data value
\param[in] pHandle is chart handle

\ingroup chart_functions
*/
FGAPI fg_err fg_get_chart_axes_limits(float* pXmin, float* pXmax,
float* pYmin, float* pYmax,
float* pZmin, float* pZmax,
const fg_chart pHandle);
/**
Set legend position for Chart

Expand Down Expand Up @@ -268,7 +285,21 @@ class Chart {
*/
FGAPI void setAxesLimits(const float pXmin, const float pXmax,
const float pYmin, const float pYmax,
const float pZmin=-1, const float pZmax=1);
const float pZmin=0, const float pZmax=0);

/**
Get axes data ranges

\param[out] pXmin is x-axis minimum data value
\param[out] pXmax is x-axis maximum data value
\param[out] pYmin is y-axis minimum data value
\param[out] pYmax is y-axis maximum data value
\param[out] pZmin is z-axis minimum data value
\param[out] pZmax is z-axis maximum data value
*/
FGAPI void getAxesLimits(float* pXmin, float* pXmax,
float* pYmin, float* pYmax,
float* pZmin = NULL, float* pZmax = NULL);

/**
Set legend position for Chart
Expand Down
20 changes: 11 additions & 9 deletions include/fg/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,19 @@ typedef enum {

/**
Color maps

\image html gfx_palette.png
*/
typedef enum {
FG_COLOR_MAP_DEFAULT = 0, ///< Default [0-255] grayscale colormap
FG_COLOR_MAP_SPECTRUM = 1, ///< Spectrum color
FG_COLOR_MAP_COLORS = 2, ///< Pure Colors
FG_COLOR_MAP_RED = 3, ///< Red color map
FG_COLOR_MAP_MOOD = 4, ///< Mood color map
FG_COLOR_MAP_HEAT = 5, ///< Heat color map
FG_COLOR_MAP_BLUE = 6 ///< Blue color map
FG_COLOR_MAP_DEFAULT = 0, ///< Default [0-255] grayscale colormap
FG_COLOR_MAP_SPECTRUM = 1, ///< Visual spectrum (390nm-830nm) in sRGB colorspace
FG_COLOR_MAP_RAINBOW = 2, ///< Rainbow color map
FG_COLOR_MAP_RED = 3, ///< Red color map
FG_COLOR_MAP_MOOD = 4, ///< Mood color map
FG_COLOR_MAP_HEAT = 5, ///< Heat color map
FG_COLOR_MAP_BLUE = 6, ///< Blue color map
FG_COLOR_MAP_INFERNO = 7, ///< perceptually uniform shades of black-red-yellow
FG_COLOR_MAP_MAGMA = 8, ///< perceptually uniform shades of black-red-white
FG_COLOR_MAP_PLASMA = 9, ///< perceptually uniform shades of blue-red-yellow
FG_COLOR_MAP_VIRIDIS = 10, ///< perceptually uniform shades of blue-green-yellow
} fg_color_map;

typedef enum {
Expand Down
22 changes: 22 additions & 0 deletions src/api/c/chart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,28 @@ fg_err fg_set_chart_axes_limits(fg_chart pHandle,
return FG_ERR_NONE;
}

fg_err fg_get_chart_axes_limits(float* pXmin, float* pXmax,
float* pYmin, float* pYmax,
float* pZmin, float* pZmax,
const fg_chart pHandle)
{
try {
float xmin, xmax, ymin, ymax, zmin, zmax;
getChart(pHandle)->getAxesLimits(&xmin, &xmax, &ymin, &ymax, &zmin, &zmax);

// Check for NULLs and assign
if(pXmin) *pXmin = xmin;
if(pXmax) *pXmax = xmax;
if(pYmin) *pYmin = ymin;
if(pYmax) *pYmax = ymax;
if(pZmin) *pZmin = zmin;
if(pZmax) *pZmax = zmax;
}
CATCHALL

return FG_ERR_NONE;
}

fg_err fg_set_chart_legend_position(fg_chart pHandle, const float pX, const float pY)
{
try {
Expand Down
18 changes: 18 additions & 0 deletions src/api/cpp/chart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ void Chart::setAxesLimits(const float pXmin, const float pXmax,
} CATCH_INTERNAL_TO_EXTERNAL
}

void Chart::getAxesLimits(float* pXmin, float* pXmax,
float* pYmin, float* pYmax,
float* pZmin, float* pZmax)
{
try {
float xmin, xmax, ymin, ymax, zmin, zmax;
getChart(mValue)->getAxesLimits(&xmin, &xmax, &ymin, &ymax, &zmin, &zmax);

// Check for NULLs and assign
if(pXmin) *pXmin = xmin;
if(pXmax) *pXmax = xmax;
if(pYmin) *pYmin = ymin;
if(pYmax) *pYmax = ymax;
if(pZmin) *pZmin = zmin;
if(pZmax) *pZmax = zmax;
} CATCH_INTERNAL_TO_EXTERNAL
}

void Chart::setLegendPosition(const float pX, const float pY)
{
try {
Expand Down
6 changes: 6 additions & 0 deletions src/backend/chart.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ class Chart {
mChart->setAxesLimits(pXmin, pXmax, pYmin, pYmax, pZmin, pZmax);
}

inline void getAxesLimits(float* pXmin, float* pXmax,
float* pYmin, float* pYmax,
float* pZmin, float* pZmax) {
mChart->getAxesLimits(pXmin, pXmax, pYmin, pYmax, pZmin, pZmax);
}

inline void setLegendPosition(const unsigned pX, const unsigned pY) {
mChart->setLegendPosition(pX, pY);
}
Expand Down
Loading