Past few days, I put together some simple utilities for using Anti-Grain Geometry with Irrlicht. It's not much. Even the docs seem overkill given how simple the project is, but why not?
Without further ado, here's the code base:
https://github.com/chronologicaldot/IrrAgg
Docs:
https://chronologicaldot.github.io/IrrAgg/
I had originally created the docs with mkdocs, so I wasn't anticipating the lack of menus in Github. Bummer. But if you have mkdocs, you can run "mkdocs serve" in the main project file and it should all build for you. The cinder theme is "required" but mkdocs should build without it. If not, just remove the "theme: cinder" line from the mkdocs.yml file.
EDIT: Scratch that. I figured out how to get it on Github correctly, so you can view it via the Docs link I gave above.
As convenient as mkdocs was, it turned out to be rather featureless with regards to making nice looking documentation. Hard to beat doxygen I guess.
IrrAgg - Vector graphics utilities
-
- Competition winner
- Posts: 688
- Joined: Mon Sep 10, 2012 8:51 am
-
- Competition winner
- Posts: 688
- Joined: Mon Sep 10, 2012 8:51 am
UPDATE IrrAgg - Vector graphics utilities
MAJOR UPDATE
I wasn't very happy with it last time. It was too disorganized. Too many tools for doing the same thing, so I decided to simplify things immensely (and name them better) and filter them down into one primary tool with helper classes for a nice plug-and-play system. In a way, it's inspired by Qt, which I've been working with lately, but Qt was frustrating and I realized I could do it better for Irrlicht anyways.
To give you an idea of how easy it is to use, here's a simple example (which I also used for debugging):
I wasn't very happy with it last time. It was too disorganized. Too many tools for doing the same thing, so I decided to simplify things immensely (and name them better) and filter them down into one primary tool with helper classes for a nice plug-and-play system. In a way, it's inspired by Qt, which I've been working with lately, but Qt was frustrating and I realized I could do it better for Irrlicht anyways.
To give you an idea of how easy it is to use, here's a simple example (which I also used for debugging):
Code: Select all
#include <irragg.h>
#include <irrlicht.h>
using irr::vecg::point_t;
using irr::vecg::Painter;
using irr::vecg::IShape;
using irr::vecg::Triangle;
using irr::vecg::Rectangle;
using irr::vecg::GhostArray;
static const point_t premadePoints[] = {
{ 50, 40 },
{ 100, 40 },
{ 250, 230 },
{ 120, 170 },
{ 75, 200 }
};
int main()
{
irr::core::vector2di zero_vector(0);
irr::core::dimension2du screen_size(512,512);
irr::IrrlichtDevice* device = irr::createDevice( irr::video::EDT_OPENGL, screen_size );
if ( !device ) return 1;
irr::video::IVideoDriver* video_driver = device->getVideoDriver();
irr::video::IImage* image = video_driver->createImage( irr::video::ECF_A8R8G8B8, screen_size );
irr::video::ITexture* texture = 0;
Triangle triangle( point_t(10,500), point_t(250, 30), point_t(500, 200) );
Rectangle rectangle( point_t(20, 40), point_t(400, 300) );
Painter painter(image);
painter.setColor( irr::video::SColor(0xffff0000) );
if ( ! painter.drawNormal(triangle) ) {
image->drop();
device->drop();
return 1;
}
painter.setColor( irr::video::SColor(0xff00ff00) );
if ( ! painter.drawStroked(rectangle) ) {
image->drop();
device->drop();
return 1;
}
const size_t size = 20;
point_t points[size];
for ( size_t i = 0; i < size; ++i ) {
points[i] = point_t( 20.0 * ((i*3)%13) + 50, 40.0 * ((i+1)%4) + 50 );
}
painter.setStrokeWidth(2);
painter.setColor( irr::video::SColor(0xff0000ff) );
//GhostArray ghostArray(premadePoints, 5);
//GhostArray ghostArray(points, size);
//if ( ! painter.drawBSpline( ghostArray ) ) {
if ( ! painter.drawBSpline( GhostArray{premadePoints, 5} ) ) {
image->drop();
device->drop();
return 1;
}
texture = video_driver->addTexture("texture0", image);
while ( device->run() ) {
video_driver->beginScene(true, true);
video_driver->draw2DImage(texture, zero_vector);
video_driver->endScene();
}
image->drop();
device->drop();
return 0;
}