mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
OP-342 GCS/ModelView - Update glc_lib to newest 2.1 release (fixes known issues) and update modelview to use this new lib.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3063 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
487b039229
commit
c00090391b
BIN
ground/openpilotgcs/src/libs/glc_lib/3DWidget/.DS_Store
vendored
Normal file
BIN
ground/openpilotgcs/src/libs/glc_lib/3DWidget/.DS_Store
vendored
Normal file
Binary file not shown.
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -97,6 +95,18 @@ void GLC_3DWidget::setWidgetManager(GLC_3DWidgetManagerHandle* pWidgetManagerHan
|
||||
create3DviewInstance();
|
||||
}
|
||||
|
||||
void GLC_3DWidget::setVisible(bool visible)
|
||||
{
|
||||
if (NULL != m_pWidgetManagerHandle)
|
||||
{
|
||||
const int instanceCount= m_InstanceIdList.size();
|
||||
for (int i= 0; i < instanceCount; ++i)
|
||||
{
|
||||
m_pWidgetManagerHandle->instanceHandle(m_InstanceIdList.at(i))->setVisibility(visible);
|
||||
}
|
||||
resetViewState();
|
||||
}
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Interaction Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -104,6 +102,9 @@ public:
|
||||
|
||||
//! Update widget representation
|
||||
virtual void updateWidgetRep(){};
|
||||
|
||||
//! Set the visibility of 3DView Instance of this widget
|
||||
void setVisible(bool visible);
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -164,6 +165,9 @@ protected:
|
||||
inline int indexOfIntsanceId(GLC_uint id)
|
||||
{return m_InstanceIdList.indexOf(id);}
|
||||
|
||||
//! Reset the view state of this 3DWidget
|
||||
virtual void resetViewState()= 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private services function
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -88,6 +86,10 @@ public:
|
||||
inline void clear()
|
||||
{m_pWidgetManagerHandle->clear();}
|
||||
|
||||
//! Set the visibility of the given 3D widget id
|
||||
inline void setWidgetVisible(GLC_uint id, bool visible)
|
||||
{m_pWidgetManagerHandle->setWidgetVisible(id, visible);}
|
||||
|
||||
//@}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Interaction Functions*/
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -105,6 +103,13 @@ void GLC_3DWidgetManagerHandle::clear()
|
||||
m_MapBetweenInstanceWidget.clear();
|
||||
}
|
||||
|
||||
void GLC_3DWidgetManagerHandle::setWidgetVisible(GLC_uint id, bool visible)
|
||||
{
|
||||
if (id == m_Active3DWidgetId) m_Active3DWidgetId= 0;
|
||||
Q_ASSERT(m_3DWidgetHash.contains(id));
|
||||
m_3DWidgetHash.value(id)->setVisible(visible);
|
||||
}
|
||||
|
||||
glc::WidgetEventFlag GLC_3DWidgetManagerHandle::mouseDoubleClickEvent(QMouseEvent *)
|
||||
{
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -128,6 +126,9 @@ public:
|
||||
//! Remove all 3D view instance from this manager
|
||||
void clear();
|
||||
|
||||
//! Set the visibility of the given 3D widget id
|
||||
void setWidgetVisible(GLC_uint id, bool visible);
|
||||
|
||||
//@}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Interaction Functions*/
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -275,6 +273,11 @@ void GLC_Axis::create3DviewInstance()
|
||||
}
|
||||
}
|
||||
|
||||
void GLC_Axis::resetViewState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GLC_Axis::moveManipulatorRep(const GLC_Point3d& pos)
|
||||
{
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -125,6 +123,9 @@ protected:
|
||||
//! Create the 3DView instance of this 3d widget
|
||||
virtual void create3DviewInstance();
|
||||
|
||||
//! Reset the view state of this 3DWidget
|
||||
virtual void resetViewState();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private services function
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -247,16 +245,7 @@ glc::WidgetEventFlag GLC_CuttingPlane::mouseReleased(Qt::MouseButton button)
|
||||
|
||||
glc::WidgetEventFlag GLC_CuttingPlane::unselect(const GLC_Point3d&, GLC_uint)
|
||||
{
|
||||
Q_ASSERT(m_SelectionIndex == -1);
|
||||
for (int i= 0; i < 4; ++i)
|
||||
{
|
||||
GLC_3DWidget::set3DViewInstanceVisibility(1 + i, false);
|
||||
}
|
||||
delete m_pCurrentManipulator;
|
||||
m_pCurrentManipulator= NULL;
|
||||
|
||||
m_CurrentManipulator= TranslationManipulator;
|
||||
|
||||
resetViewState();
|
||||
return glc::AcceptEvent;
|
||||
}
|
||||
|
||||
@ -359,6 +348,18 @@ void GLC_CuttingPlane::create3DviewInstance()
|
||||
GLC_3DWidget::set3DViewInstanceVisibility(4, false);
|
||||
}
|
||||
|
||||
void GLC_CuttingPlane::resetViewState()
|
||||
{
|
||||
Q_ASSERT(m_SelectionIndex == -1);
|
||||
for (int i= 0; i < 4; ++i)
|
||||
{
|
||||
GLC_3DWidget::set3DViewInstanceVisibility(1 + i, false);
|
||||
}
|
||||
m_pCurrentManipulator= NULL;
|
||||
|
||||
m_CurrentManipulator= TranslationManipulator;
|
||||
}
|
||||
|
||||
void GLC_CuttingPlane::moveManipulatorRep(const GLC_Point3d& pos)
|
||||
{
|
||||
// Create the widget rotation matrix
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -136,6 +134,8 @@ protected:
|
||||
//! Create the 3DView instance of this 3d widget
|
||||
virtual void create3DviewInstance();
|
||||
|
||||
//! Reset the view state of this 3DWidget
|
||||
virtual void resetViewState();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private services function
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -67,13 +65,6 @@ GLC_Matrix4x4 GLC_PullManipulator::doManipulate(const GLC_Point3d& newPoint, con
|
||||
GLC_Line3d projectionLine(newPoint, projectionDirection);
|
||||
glc::lineIntersectPlane(projectionLine, GLC_AbstractManipulator::m_SliddingPlane, &projectedPoint);
|
||||
|
||||
// Construct the plane throw previous position and pull direction oriented with camera side vector
|
||||
GLC_Vector3d projNormal= (GLC_AbstractManipulator::m_pViewport->cameraHandle()->sideVector() ^ m_PullDirection).normalize();
|
||||
GLC_Plane projPlane(projNormal, GLC_AbstractManipulator::m_PreviousPosition);
|
||||
|
||||
// Project the point on the previous computed plane
|
||||
glc::lineIntersectPlane(projectionLine, projPlane, &projectedPoint);
|
||||
|
||||
// Project the point on the pulling direction
|
||||
projectedPoint= glc::project(projectedPoint, GLC_Line3d(GLC_AbstractManipulator::previousPosition(), m_PullDirection));
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -3541,11 +3541,15 @@ extern "C" {
|
||||
#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6
|
||||
#endif
|
||||
|
||||
/* Laumaya for GLC_lib compiler warning with QT 4.7
|
||||
* 10/12/2010
|
||||
* Swap reuse from ARB to NV
|
||||
*/
|
||||
#ifndef GL_NV_geometry_program4
|
||||
#define GL_LINES_ADJACENCY_EXT 0x000A
|
||||
#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
|
||||
#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
|
||||
#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
|
||||
/* reuse GL_LINES_ADJACENCY_EXT */
|
||||
/* reuse GL_LINE_STRIP_ADJACENCY_EXT */
|
||||
/* reuse GL_TRIANGLES_ADJACENCY_EXT */
|
||||
/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */
|
||||
#define GL_GEOMETRY_PROGRAM_NV 0x8C26
|
||||
#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27
|
||||
#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28
|
||||
@ -3553,11 +3557,11 @@ extern "C" {
|
||||
#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB
|
||||
#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC
|
||||
#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
|
||||
#define GL_PROGRAM_POINT_SIZE_EXT 0x8642
|
||||
/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */
|
||||
/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */
|
||||
/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */
|
||||
/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
|
||||
/* reuse GL_PROGRAM_POINT_SIZE_EXT */
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_geometry_shader4
|
||||
@ -3572,15 +3576,15 @@ extern "C" {
|
||||
#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
|
||||
#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
|
||||
#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
|
||||
/* reuse GL_LINES_ADJACENCY_EXT */
|
||||
/* reuse GL_LINE_STRIP_ADJACENCY_EXT */
|
||||
/* reuse GL_TRIANGLES_ADJACENCY_EXT */
|
||||
/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */
|
||||
/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */
|
||||
/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */
|
||||
/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */
|
||||
/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
|
||||
/* reuse GL_PROGRAM_POINT_SIZE_EXT */
|
||||
//#define GL_LINES_ADJACENCY_EXT 0x000A
|
||||
//#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
|
||||
//#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
|
||||
//#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
|
||||
#define GL_PROGRAM_POINT_SIZE_EXT 0x8642
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_vertex_program4
|
||||
|
@ -41,14 +41,14 @@ static char lib3ds_chunk_level[128]="";
|
||||
|
||||
|
||||
static void
|
||||
lib3ds_chunk_debug_enter(Lib3dsChunk *c __attribute((unused)))
|
||||
lib3ds_chunk_debug_enter(Lib3dsChunk *c)
|
||||
{
|
||||
strcat(lib3ds_chunk_level, " ");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
lib3ds_chunk_debug_leave(Lib3dsChunk *c __attribute((unused)))
|
||||
lib3ds_chunk_debug_leave(Lib3dsChunk *c)
|
||||
{
|
||||
lib3ds_chunk_level[strlen(lib3ds_chunk_level)-2]=0;
|
||||
}
|
||||
@ -62,7 +62,7 @@ lib3ds_chunk_debug_dump(Lib3dsChunk *c)
|
||||
lib3ds_chunk_level,
|
||||
lib3ds_chunk_name(c->chunk),
|
||||
c->chunk,
|
||||
(long unsigned int)c->size
|
||||
c->size
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ lib3ds_chunk_read_next(Lib3dsChunk *c, Lib3dsIo *io)
|
||||
* \ingroup chunk
|
||||
*/
|
||||
void
|
||||
lib3ds_chunk_read_reset(Lib3dsChunk *c __attribute((unused)), Lib3dsIo *io)
|
||||
lib3ds_chunk_read_reset(Lib3dsChunk *c, Lib3dsIo *io)
|
||||
{
|
||||
lib3ds_io_seek(io, -6, LIB3DS_SEEK_CUR);
|
||||
}
|
||||
|
@ -1940,13 +1940,6 @@ file_bounding_box_of_nodes_impl(Lib3dsNode *node, Lib3dsFile *file, Lib3dsBool i
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LIB3DS_UNKNOWN_NODE:
|
||||
case LIB3DS_AMBIENT_NODE:
|
||||
case LIB3DS_CAMERA_NODE:
|
||||
case LIB3DS_TARGET_NODE:
|
||||
case LIB3DS_LIGHT_NODE:
|
||||
case LIB3DS_SPOT_NODE:
|
||||
break;
|
||||
/*
|
||||
case LIB3DS_CAMERA_NODE:
|
||||
case LIB3DS_TARGET_NODE:
|
||||
|
@ -30,7 +30,7 @@
|
||||
/*!
|
||||
* \defgroup light Lights
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -570,8 +570,8 @@ lib3ds_mesh_dump(Lib3dsMesh *mesh)
|
||||
ASSERT(mesh);
|
||||
printf(" %s vertices=%ld faces=%ld\n",
|
||||
mesh->name,
|
||||
(long int)mesh->points,
|
||||
(long int)mesh->faces
|
||||
mesh->points,
|
||||
mesh->faces
|
||||
);
|
||||
printf(" matrix:\n");
|
||||
lib3ds_matrix_dump(mesh->matrix);
|
||||
|
@ -70,7 +70,7 @@ typedef enum {
|
||||
/* Bit 11-12: Unused ? */
|
||||
LIB3DS_FACE_FLAG_SELECT_3 = (1<<13), /*!< Bit 13: Selection of the face in selection 3*/
|
||||
LIB3DS_FACE_FLAG_SELECT_2 = (1<<14), /*!< Bit 14: Selection of the face in selection 2*/
|
||||
LIB3DS_FACE_FLAG_SELECT_1 = (1<<15) /*!< Bit 15: Selection of the face in selection 1*/
|
||||
LIB3DS_FACE_FLAG_SELECT_1 = (1<<15), /*!< Bit 15: Selection of the face in selection 1*/
|
||||
} Lib3dsFaceFlag;
|
||||
|
||||
/**
|
||||
|
@ -485,7 +485,7 @@ lib3ds_node_dump(Lib3dsNode *node, Lib3dsIntd level)
|
||||
* \ingroup node
|
||||
*/
|
||||
Lib3dsBool
|
||||
lib3ds_node_read(Lib3dsNode *node, Lib3dsFile *file __attribute((unused)), Lib3dsIo *io)
|
||||
lib3ds_node_read(Lib3dsNode *node, Lib3dsFile *file, Lib3dsIo *io)
|
||||
{
|
||||
Lib3dsChunk c;
|
||||
Lib3dsWord chunk;
|
||||
|
@ -1407,7 +1407,7 @@ lib3ds_morph_track_read(Lib3dsMorphTrack *track, Lib3dsIo *io)
|
||||
* \ingroup tracks
|
||||
*/
|
||||
Lib3dsBool
|
||||
lib3ds_morph_track_write(Lib3dsMorphTrack *track __attribute((unused)), Lib3dsIo *io __attribute((unused)))
|
||||
lib3ds_morph_track_write(Lib3dsMorphTrack *track, Lib3dsIo *io)
|
||||
{
|
||||
/* FIXME: */
|
||||
ASSERT(0);
|
||||
@ -1548,7 +1548,5 @@ lib3ds_dump_tracks(Lib3dsNode *node)
|
||||
printf("pos: ");
|
||||
lib3ds_lin3Track_dump(&node->data.spot.pos_track);
|
||||
break;
|
||||
case LIB3DS_UNKNOWN_NODE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ lib3ds_viewport_dump(Lib3dsViewport *vp)
|
||||
printf(" position: %d,%d\n",
|
||||
vp->layout.position[0], vp->layout.position[1]);
|
||||
printf(" size: %d,%d\n", vp->layout.size[0], vp->layout.size[1]);
|
||||
printf(" views: %ld\n", (long int)vp->layout.views);
|
||||
printf(" views: %ld\n", vp->layout.views);
|
||||
if (vp->layout.views > 0 && vp->layout.viewL != NULL) {
|
||||
for(i=0, view=vp->layout.viewL; i < vp->layout.views; ++i, ++view) {
|
||||
printf(" view %d:\n", i);
|
||||
|
@ -32,7 +32,7 @@
|
||||
/***********************************************************************
|
||||
* Return the next byte in the pseudo-random sequence
|
||||
*/
|
||||
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab __attribute((unused)))
|
||||
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
|
||||
{
|
||||
//(void) pcrc_32_tab; /* avoid "unused parameter" warning */
|
||||
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||
|
@ -66,7 +66,7 @@ int ZCALLBACK ferror_file_func OF((
|
||||
|
||||
|
||||
voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
|
||||
voidpf opaque __attribute((unused));
|
||||
voidpf opaque;
|
||||
const char* filename;
|
||||
int mode;
|
||||
{
|
||||
@ -89,7 +89,7 @@ voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
|
||||
|
||||
|
||||
uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
|
||||
voidpf opaque __attribute((unused));
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
void* buf;
|
||||
uLong size;
|
||||
@ -102,7 +102,7 @@ uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
|
||||
|
||||
|
||||
uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
|
||||
voidpf opaque __attribute((unused));
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
const void* buf;
|
||||
uLong size;
|
||||
@ -114,7 +114,7 @@ uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
|
||||
}
|
||||
|
||||
long ZCALLBACK ftell_file_func (opaque, stream)
|
||||
voidpf opaque __attribute((unused));
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
{
|
||||
//(void) opaque; /* avoid "unused parameter" warning */
|
||||
@ -124,7 +124,7 @@ long ZCALLBACK ftell_file_func (opaque, stream)
|
||||
}
|
||||
|
||||
long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
||||
voidpf opaque __attribute((unused));
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
uLong offset;
|
||||
int origin;
|
||||
@ -151,7 +151,7 @@ long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
||||
}
|
||||
|
||||
int ZCALLBACK fclose_file_func (opaque, stream)
|
||||
voidpf opaque __attribute((unused));
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
{
|
||||
//(void) opaque; /* avoid "unused parameter" warning */
|
||||
@ -161,7 +161,7 @@ int ZCALLBACK fclose_file_func (opaque, stream)
|
||||
}
|
||||
|
||||
int ZCALLBACK ferror_file_func (opaque, stream)
|
||||
voidpf opaque __attribute((unused));
|
||||
voidpf opaque;
|
||||
voidpf stream;
|
||||
{
|
||||
//(void) opaque; /* avoid "unused parameter" warning */
|
||||
|
@ -318,7 +318,7 @@ local void ziplocal_putValue_inmemory (dest, x, nbByte)
|
||||
|
||||
local uLong ziplocal_TmzDateToDosDate(ptm,dosDate)
|
||||
const tm_zip* ptm;
|
||||
uLong dosDate __attribute((unused));
|
||||
uLong dosDate;
|
||||
{
|
||||
//(void) dosDate; /* avoid "unused parameter" warning */
|
||||
uLong year = (uLong)ptm->tm_year;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -25,6 +23,7 @@
|
||||
#include "glc_3drep.h"
|
||||
#include "../glc_factory.h"
|
||||
#include "glc_mesh.h"
|
||||
#include "glc_errorlog.h"
|
||||
|
||||
// Class chunk id
|
||||
quint32 GLC_3DRep::m_ChunkId= 0xA702;
|
||||
@ -45,6 +44,7 @@ GLC_3DRep::GLC_3DRep(GLC_Geometry* pGeom)
|
||||
, m_pType(new int(GLC_Rep::GLC_VBOGEOM))
|
||||
{
|
||||
m_pGeomList->append(pGeom);
|
||||
*m_pIsLoaded= true;
|
||||
setName(pGeom->name());
|
||||
}
|
||||
|
||||
@ -58,12 +58,17 @@ GLC_3DRep::GLC_3DRep(const GLC_3DRep& rep)
|
||||
}
|
||||
|
||||
// Assignement operator
|
||||
GLC_3DRep& GLC_3DRep::operator=(const GLC_3DRep& rep)
|
||||
GLC_3DRep& GLC_3DRep::operator=(const GLC_Rep& rep)
|
||||
{
|
||||
clear();
|
||||
GLC_Rep::operator=(rep);
|
||||
m_pGeomList= rep.m_pGeomList;
|
||||
m_pType= rep.m_pType;
|
||||
const GLC_3DRep* p3DRep= dynamic_cast<const GLC_3DRep*>(&rep);
|
||||
Q_ASSERT(NULL != p3DRep);
|
||||
if (this != &rep)
|
||||
{
|
||||
clear();
|
||||
GLC_Rep::operator=(rep);
|
||||
m_pGeomList= p3DRep->m_pGeomList;
|
||||
m_pType= p3DRep->m_pType;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -237,28 +242,37 @@ void GLC_3DRep::reverseNormals()
|
||||
// Load the representation
|
||||
bool GLC_3DRep::load()
|
||||
{
|
||||
Q_ASSERT((!(*m_pIsLoaded)) == m_pGeomList->isEmpty());
|
||||
if ((*m_pIsLoaded) || fileName().isEmpty())
|
||||
bool loadSucces= false;
|
||||
|
||||
if(!(*m_pIsLoaded))
|
||||
{
|
||||
qDebug() << "GLC_3DRep::load() Allready loaded or empty fileName";
|
||||
return false;
|
||||
}
|
||||
GLC_3DRep newRep= GLC_Factory::instance()->create3DRepFromFile(fileName());
|
||||
if (!newRep.isEmpty())
|
||||
{
|
||||
const int size= newRep.m_pGeomList->size();
|
||||
for (int i= 0; i < size; ++i)
|
||||
Q_ASSERT(m_pGeomList->isEmpty());
|
||||
if (fileName().isEmpty())
|
||||
{
|
||||
m_pGeomList->append(newRep.m_pGeomList->at(i));
|
||||
QStringList stringList("GLC_3DRep::load");
|
||||
stringList.append("Representation : " + GLC_Rep::name());
|
||||
stringList.append("Empty File Name");
|
||||
GLC_ErrorLog::addError(stringList);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLC_3DRep newRep= GLC_Factory::instance()->create3DRepFromFile(fileName());
|
||||
if (!newRep.isEmpty())
|
||||
{
|
||||
const int size= newRep.m_pGeomList->size();
|
||||
for (int i= 0; i < size; ++i)
|
||||
{
|
||||
m_pGeomList->append(newRep.m_pGeomList->at(i));
|
||||
}
|
||||
newRep.m_pGeomList->clear();
|
||||
(*m_pIsLoaded)= true;
|
||||
loadSucces= true;
|
||||
}
|
||||
}
|
||||
newRep.m_pGeomList->clear();
|
||||
(*m_pIsLoaded)= true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return loadSucces;
|
||||
|
||||
}
|
||||
// Replace the representation
|
||||
void GLC_3DRep::replace(GLC_Rep* pRep)
|
||||
@ -302,7 +316,7 @@ void GLC_3DRep::replaceMaterial(GLC_uint oldId, GLC_Material* pNewMaterial)
|
||||
}
|
||||
|
||||
// Merge this 3Drep with another 3DRep
|
||||
void GLC_3DRep::merge(GLC_3DRep* pRep)
|
||||
void GLC_3DRep::merge(const GLC_3DRep* pRep)
|
||||
{
|
||||
// Get the number of geometry of pRep
|
||||
const int pRepSize= pRep->m_pGeomList->size();
|
||||
@ -312,6 +326,17 @@ void GLC_3DRep::merge(GLC_3DRep* pRep)
|
||||
}
|
||||
}
|
||||
|
||||
void GLC_3DRep::take(GLC_3DRep* pSource)
|
||||
{
|
||||
// Get the number of geometry of pRep
|
||||
const int pRepSize= pSource->m_pGeomList->size();
|
||||
for (int i= 0; i < pRepSize; ++i)
|
||||
{
|
||||
addGeom(pSource->geomAt(i));
|
||||
}
|
||||
pSource->m_pGeomList->clear();
|
||||
}
|
||||
|
||||
void GLC_3DRep::copyVboToClientSide()
|
||||
{
|
||||
// Get the number of geometry of pRep
|
||||
@ -332,24 +357,47 @@ void GLC_3DRep::releaseVboClientSide(bool update)
|
||||
}
|
||||
}
|
||||
|
||||
void GLC_3DRep::transformSubGeometries(const GLC_Matrix4x4& matrix)
|
||||
{
|
||||
// Get the number of geometry of pRep
|
||||
const int repCount= m_pGeomList->size();
|
||||
qDebug() << "repCount " << repCount;
|
||||
for (int i= 0; i < repCount; ++i)
|
||||
{
|
||||
GLC_Mesh* pCurrentMesh= dynamic_cast<GLC_Mesh*>(geomAt(i));
|
||||
if (NULL != pCurrentMesh)
|
||||
{
|
||||
pCurrentMesh->transformVertice(matrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UnLoad the representation
|
||||
bool GLC_3DRep::unload()
|
||||
{
|
||||
Q_ASSERT((!(*m_pIsLoaded)) == m_pGeomList->isEmpty());
|
||||
if (!(*m_pIsLoaded) || fileName().isEmpty())
|
||||
bool unloadSucess= false;
|
||||
if ((NULL != m_pGeomList) && !m_pGeomList->isEmpty())
|
||||
{
|
||||
qDebug() << "GLC_3DRep::unload() Not loaded or empty fileName";
|
||||
return false;
|
||||
}
|
||||
if (fileName().isEmpty())
|
||||
{
|
||||
QStringList stringList("GLC_3DRep::unload()");
|
||||
stringList.append("Cannot unload rep without filename");
|
||||
GLC_ErrorLog::addError(stringList);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int size= m_pGeomList->size();
|
||||
for (int i= 0; i < size; ++i)
|
||||
{
|
||||
delete (*m_pGeomList)[i];
|
||||
}
|
||||
m_pGeomList->clear();
|
||||
|
||||
const int size= m_pGeomList->size();
|
||||
for (int i= 0; i < size; ++i)
|
||||
{
|
||||
delete (*m_pGeomList)[i];
|
||||
(*m_pIsLoaded)= false;
|
||||
unloadSucess= true;
|
||||
}
|
||||
}
|
||||
|
||||
(*m_pIsLoaded)= false;
|
||||
return true;
|
||||
return unloadSucess;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -37,8 +35,8 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_LIB_EXPORT GLC_3DRep : public GLC_Rep
|
||||
{
|
||||
friend QDataStream &operator<<(QDataStream &, const GLC_3DRep &);
|
||||
friend QDataStream &operator>>(QDataStream &, GLC_3DRep &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_3DRep &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_3DRep &);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! @name Constructor / Destructor */
|
||||
@ -55,7 +53,7 @@ public:
|
||||
GLC_3DRep(const GLC_3DRep&);
|
||||
|
||||
//! Assignement operator
|
||||
virtual GLC_3DRep &operator=(const GLC_3DRep&);
|
||||
virtual GLC_3DRep &operator=(const GLC_Rep&);
|
||||
|
||||
//! Clone the representation
|
||||
virtual GLC_Rep* clone() const;
|
||||
@ -132,7 +130,10 @@ public:
|
||||
public:
|
||||
//! Add Geometry to the 3DRep
|
||||
inline void addGeom(GLC_Geometry* pGeom)
|
||||
{m_pGeomList->append(pGeom);}
|
||||
{
|
||||
m_pGeomList->append(pGeom);
|
||||
*m_pIsLoaded= true;
|
||||
}
|
||||
|
||||
//! Remove empty geometries and factorise materials
|
||||
void clean();
|
||||
@ -153,7 +154,10 @@ public:
|
||||
void replaceMaterial(GLC_uint, GLC_Material*);
|
||||
|
||||
//! Merge this 3Drep with another 3DRep
|
||||
void merge(GLC_3DRep*);
|
||||
void merge(const GLC_3DRep*);
|
||||
|
||||
//! Take the geometry of another 3DRep
|
||||
void take(GLC_3DRep* pSource);
|
||||
|
||||
//! Copy VBO to the Client Side
|
||||
void copyVboToClientSide();
|
||||
@ -161,6 +165,9 @@ public:
|
||||
//! Release client VBO
|
||||
void releaseVboClientSide(bool update= false);
|
||||
|
||||
//! Transform 3DRep sub mesh vertice with the given matrix
|
||||
void transformSubGeometries(const GLC_Matrix4x4& matrix);
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
@ -187,7 +194,7 @@ private:
|
||||
};
|
||||
|
||||
//! Non-member stream operator
|
||||
QDataStream &operator<<(QDataStream &, const GLC_3DRep &);
|
||||
QDataStream &operator>>(QDataStream &, GLC_3DRep &);
|
||||
GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_3DRep &);
|
||||
GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_3DRep &);
|
||||
|
||||
#endif /* GLC_3DREP_H_ */
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -146,7 +144,7 @@ void GLC_Arrow::glDraw(const GLC_RenderProperties& renderProperties)
|
||||
createWire();
|
||||
}
|
||||
|
||||
m_WireData.glDraw(renderProperties);
|
||||
m_WireData.glDraw(renderProperties, GL_LINE_STRIP);
|
||||
}
|
||||
|
||||
void GLC_Arrow::createWire()
|
||||
@ -160,7 +158,7 @@ void GLC_Arrow::createWire()
|
||||
floatVector.append(static_cast<float>(m_EndPoint.y()));
|
||||
floatVector.append(static_cast<float>(m_EndPoint.z()));
|
||||
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
|
||||
// Arrow Head
|
||||
GLC_Point3d headPoint1(-m_HeadLenght, m_HeadLenght * tan(m_HeadAngle / 2.0), 0.0);
|
||||
@ -193,6 +191,6 @@ void GLC_Arrow::createWire()
|
||||
floatVector.append(static_cast<float>(headPoint2.y()));
|
||||
floatVector.append(static_cast<float>(headPoint2.z()));
|
||||
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -297,7 +295,7 @@ void GLC_Box::createWire()
|
||||
floatVector << -lgX << lgY << -lgZ;
|
||||
floatVector << -lgX << lgY << lgZ;
|
||||
floatVector << lgX << lgY << lgZ;
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
floatVector.clear();
|
||||
|
||||
floatVector << lgX << -lgY << lgZ;
|
||||
@ -305,27 +303,27 @@ void GLC_Box::createWire()
|
||||
floatVector << -lgX << -lgY << -lgZ;
|
||||
floatVector << -lgX << -lgY << lgZ;
|
||||
floatVector << lgX << -lgY << lgZ;
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
floatVector.clear();
|
||||
|
||||
floatVector << lgX << lgY << lgZ;
|
||||
floatVector << lgX << -lgY << lgZ;
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
floatVector.clear();
|
||||
|
||||
floatVector << lgX << lgY << -lgZ;
|
||||
floatVector << lgX << -lgY << -lgZ;
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
floatVector.clear();
|
||||
|
||||
floatVector << -lgX << lgY << -lgZ;
|
||||
floatVector << -lgX << -lgY << -lgZ;
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
floatVector.clear();
|
||||
|
||||
floatVector << -lgX << lgY << lgZ;
|
||||
floatVector << -lgX << -lgY << lgZ;
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
floatVector.clear();
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -25,6 +23,7 @@
|
||||
|
||||
#include "glc_bsrep.h"
|
||||
#include "../glc_fileformatexception.h"
|
||||
#include "../glc_tracelog.h"
|
||||
|
||||
// The binary rep suffix
|
||||
const QString GLC_BSRep::m_Suffix("BSRep");
|
||||
@ -33,8 +32,10 @@ const QString GLC_BSRep::m_Suffix("BSRep");
|
||||
const QUuid GLC_BSRep::m_Uuid("{d6f97789-36a9-4c2e-b667-0e66c27f839f}");
|
||||
|
||||
// The binary rep version
|
||||
const quint32 GLC_BSRep::m_Version= 101;
|
||||
const quint32 GLC_BSRep::m_Version= 102;
|
||||
|
||||
// Mutex used by compression
|
||||
QMutex GLC_BSRep::m_CompressionMutex;
|
||||
|
||||
// Default constructor
|
||||
GLC_BSRep::GLC_BSRep(const QString& fileName, bool useCompression)
|
||||
@ -43,7 +44,6 @@ GLC_BSRep::GLC_BSRep(const QString& fileName, bool useCompression)
|
||||
, m_DataStream()
|
||||
, m_UseCompression(useCompression)
|
||||
, m_CompressionLevel(-1)
|
||||
, m_VersionIsCompatible(false)
|
||||
{
|
||||
setAbsoluteFileName(fileName);
|
||||
m_DataStream.setVersion(QDataStream::Qt_4_6);
|
||||
@ -68,36 +68,31 @@ GLC_BSRep::~GLC_BSRep()
|
||||
}
|
||||
|
||||
// Return true if the binary rep is up to date
|
||||
bool GLC_BSRep::repIsUpToDate(const QDateTime& timeStamp)
|
||||
bool GLC_BSRep::isUsable(const QDateTime& timeStamp)
|
||||
{
|
||||
//qDebug() << "GLC_BSRep::repIsUpToDate";
|
||||
bool isUpToDate= false;
|
||||
if (open(QIODevice::ReadOnly))
|
||||
{
|
||||
if (headerIsOk())
|
||||
{
|
||||
isUpToDate= m_VersionIsCompatible && timeStampOk(timeStamp);
|
||||
isUpToDate= timeStampOk(timeStamp);
|
||||
isUpToDate= isUpToDate && close();
|
||||
}
|
||||
else
|
||||
{
|
||||
QString message(QString("GLC_BSRep::loadRep File not recognise ") + m_FileInfo.fileName());
|
||||
qDebug() << message;
|
||||
GLC_FileFormatException fileFormatException(message, m_FileInfo.fileName(), GLC_FileFormatException::WrongFileFormat);
|
||||
close();
|
||||
throw(fileFormatException);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QString message(QString("GLC_BSRep::loadRep Enable to open the file ") + m_FileInfo.fileName());
|
||||
qDebug() << message;
|
||||
GLC_FileFormatException fileFormatException(message, m_FileInfo.fileName(), GLC_FileFormatException::FileNotFound);
|
||||
close();
|
||||
throw(fileFormatException);
|
||||
}
|
||||
|
||||
if (!isUpToDate) qDebug() << "Rep is not up to date";
|
||||
if (!isUpToDate && GLC_TraceLog::isEnable())
|
||||
{
|
||||
QStringList stringList("GLC_BSRep::isUsable");
|
||||
stringList.append("File " + m_FileInfo.filePath() + " not Usable");
|
||||
GLC_TraceLog::addTrace(stringList);
|
||||
}
|
||||
return isUpToDate;
|
||||
}
|
||||
|
||||
@ -107,7 +102,6 @@ bool GLC_BSRep::repIsUpToDate(const QDateTime& timeStamp)
|
||||
// Load the binary rep
|
||||
GLC_3DRep GLC_BSRep::loadRep()
|
||||
{
|
||||
//qDebug() << "GLC_BSRep::loadRep";
|
||||
GLC_3DRep loadedRep;
|
||||
|
||||
if (open(QIODevice::ReadOnly))
|
||||
@ -124,7 +118,9 @@ GLC_3DRep GLC_BSRep::loadRep()
|
||||
QByteArray CompresseBuffer;
|
||||
m_DataStream >> CompresseBuffer;
|
||||
QByteArray uncompressedBuffer= qUncompress(CompresseBuffer);
|
||||
uncompressedBuffer.squeeze();
|
||||
CompresseBuffer.clear();
|
||||
CompresseBuffer.squeeze();
|
||||
QDataStream bufferStream(uncompressedBuffer);
|
||||
bufferStream >> loadedRep;
|
||||
}
|
||||
@ -132,11 +128,11 @@ GLC_3DRep GLC_BSRep::loadRep()
|
||||
{
|
||||
m_DataStream >> loadedRep;
|
||||
}
|
||||
loadedRep.setFileName(m_FileInfo.filePath());
|
||||
|
||||
if (!close())
|
||||
{
|
||||
QString message(QString("GLC_BSRep::loadRep An error occur when loading file ") + m_FileInfo.fileName());
|
||||
qDebug() << message;
|
||||
GLC_FileFormatException fileFormatException(message, m_FileInfo.fileName(), GLC_FileFormatException::WrongFileFormat);
|
||||
throw(fileFormatException);
|
||||
}
|
||||
@ -144,7 +140,6 @@ GLC_3DRep GLC_BSRep::loadRep()
|
||||
else
|
||||
{
|
||||
QString message(QString("GLC_BSRep::loadRep File not supported ") + m_FileInfo.fileName());
|
||||
qDebug() << message;
|
||||
GLC_FileFormatException fileFormatException(message, m_FileInfo.fileName(), GLC_FileFormatException::FileNotSupported);
|
||||
close();
|
||||
throw(fileFormatException);
|
||||
@ -153,7 +148,6 @@ GLC_3DRep GLC_BSRep::loadRep()
|
||||
else
|
||||
{
|
||||
QString message(QString("GLC_BSRep::loadRep Enable to open the file ") + m_FileInfo.fileName());
|
||||
qDebug() << message;
|
||||
GLC_FileFormatException fileFormatException(message, m_FileInfo.fileName(), GLC_FileFormatException::FileNotFound);
|
||||
close();
|
||||
throw(fileFormatException);
|
||||
@ -176,6 +170,7 @@ GLC_BoundingBox GLC_BSRep::boundingBox()
|
||||
|
||||
m_DataStream >> boundingBox;
|
||||
}
|
||||
close();
|
||||
}
|
||||
return boundingBox;
|
||||
}
|
||||
@ -203,7 +198,7 @@ void GLC_BSRep::setAbsoluteFileName(const QString& fileName)
|
||||
// Save the GLC_3DRep in serialised binary
|
||||
bool GLC_BSRep::save(const GLC_3DRep& rep)
|
||||
{
|
||||
qDebug() << "GLC_BSRep::save";
|
||||
|
||||
//! Check if the currentFileInfo is valid and writable
|
||||
bool saveOk= open(QIODevice::WriteOnly);
|
||||
if (saveOk)
|
||||
@ -214,21 +209,34 @@ bool GLC_BSRep::save(const GLC_3DRep& rep)
|
||||
m_DataStream << rep.boundingBox();
|
||||
|
||||
// Compression usage
|
||||
m_DataStream << m_UseCompression;
|
||||
if (m_UseCompression)
|
||||
|
||||
if (m_UseCompression && (rep.faceCount() < 1000000))
|
||||
{
|
||||
m_DataStream << true;
|
||||
QByteArray uncompressedBuffer;
|
||||
QDataStream bufferStream(&uncompressedBuffer, QIODevice::WriteOnly);
|
||||
bufferStream << rep;
|
||||
{
|
||||
QBuffer buffer(&uncompressedBuffer);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
QDataStream bufferStream(&buffer);
|
||||
bufferStream << rep;
|
||||
}
|
||||
m_DataStream << qCompress(uncompressedBuffer, m_CompressionLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DataStream << false;
|
||||
// Binary representation geometry
|
||||
// Add the rep
|
||||
m_DataStream << rep;
|
||||
}
|
||||
|
||||
// Flag the file
|
||||
qint64 offset= sizeof(QUuid);
|
||||
offset+= sizeof(quint32);
|
||||
|
||||
m_pFile->seek(offset);
|
||||
bool writeOk= true;
|
||||
m_DataStream << writeOk;
|
||||
// Close the file
|
||||
saveOk= close();
|
||||
}
|
||||
@ -239,7 +247,6 @@ bool GLC_BSRep::save(const GLC_3DRep& rep)
|
||||
// Open the file
|
||||
bool GLC_BSRep::open(QIODevice::OpenMode mode)
|
||||
{
|
||||
//qDebug() << "Open :" << m_FileInfo.fileName();
|
||||
bool openOk= m_FileInfo.exists();
|
||||
if (openOk || (mode == QIODevice::WriteOnly))
|
||||
{
|
||||
@ -252,10 +259,13 @@ bool GLC_BSRep::open(QIODevice::OpenMode mode)
|
||||
m_DataStream.setDevice(m_pFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (GLC_TraceLog::isEnable())
|
||||
{
|
||||
qDebug() << "File info " << m_FileInfo.filePath() << " do not exists";
|
||||
QStringList stringList("GLC_BSRep::open");
|
||||
stringList.append("File " + m_FileInfo.filePath() + " doesn't exists");
|
||||
GLC_TraceLog::addTrace(stringList);
|
||||
}
|
||||
|
||||
return openOk;
|
||||
}
|
||||
|
||||
@ -278,13 +288,14 @@ void GLC_BSRep::writeHeader(const QDateTime& dateTime)
|
||||
{
|
||||
Q_ASSERT(m_pFile != NULL);
|
||||
Q_ASSERT(m_DataStream.device() != NULL);
|
||||
Q_ASSERT(m_pFile->openMode() == QIODevice::WriteOnly);
|
||||
|
||||
// Binary representation Header
|
||||
// Add the magic number
|
||||
m_DataStream << m_Uuid;
|
||||
// Add the version
|
||||
m_DataStream << m_Version;
|
||||
bool writeFinished= false;
|
||||
m_DataStream << writeFinished;
|
||||
|
||||
// Set the version of the data stream
|
||||
m_DataStream.setVersion(QDataStream::Qt_4_6);
|
||||
@ -302,14 +313,16 @@ bool GLC_BSRep::headerIsOk()
|
||||
|
||||
QUuid uuid;
|
||||
quint32 version;
|
||||
bool writeFinished;
|
||||
|
||||
m_DataStream >> uuid;
|
||||
m_DataStream >> version;
|
||||
m_DataStream >> writeFinished;
|
||||
|
||||
// Set the version of the data stream
|
||||
m_DataStream.setVersion(QDataStream::Qt_4_6);
|
||||
|
||||
bool headerOk= (uuid == m_Uuid);
|
||||
m_VersionIsCompatible= (version == m_Version);
|
||||
bool headerOk= (uuid == m_Uuid) && (version == m_Version) && writeFinished;
|
||||
|
||||
return headerOk;
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -31,6 +29,7 @@
|
||||
#include <QDataStream>
|
||||
#include <QUuid>
|
||||
#include <QDateTime>
|
||||
#include <QMutex>
|
||||
|
||||
#include "../glc_config.h"
|
||||
#include "glc_3drep.h"
|
||||
@ -65,8 +64,8 @@ public:
|
||||
inline QString absoluteFileName() const
|
||||
{return m_FileInfo.fileName();}
|
||||
|
||||
//! Return true if the binary rep is up to date
|
||||
bool repIsUpToDate(const QDateTime&);
|
||||
//! Return true if the binary rep is usable
|
||||
bool isUsable(const QDateTime&);
|
||||
|
||||
//! Load the binary rep
|
||||
GLC_3DRep loadRep();
|
||||
@ -147,8 +146,8 @@ private:
|
||||
//! The compression level
|
||||
int m_CompressionLevel;
|
||||
|
||||
//! Flag to know if the version is compatible
|
||||
bool m_VersionIsCompatible;
|
||||
//! Compression Mutex
|
||||
static QMutex m_CompressionMutex;
|
||||
|
||||
};
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -140,7 +138,7 @@ void GLC_Circle::glDraw(const GLC_RenderProperties& renderProperties)
|
||||
createWire();
|
||||
}
|
||||
|
||||
m_WireData.glDraw(renderProperties);
|
||||
m_WireData.glDraw(renderProperties, GL_LINE_STRIP);
|
||||
}
|
||||
|
||||
// Create the wire
|
||||
@ -165,5 +163,5 @@ void GLC_Circle::createWire()
|
||||
floatVector[(i * 3) + 1]= static_cast<float>(m_Radius * sin(static_cast<double>(i) * angleOnStep));
|
||||
floatVector[(i * 3) + 2]= 0.0f;
|
||||
}
|
||||
GLC_Geometry::addPolyline(floatVector);
|
||||
GLC_Geometry::addVerticeGroup(floatVector);
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -226,7 +224,7 @@ void GLC_Cone::createMeshAndWire()
|
||||
GLC_Mesh::addTexels(texelVector);
|
||||
|
||||
// Add polyline to wire data
|
||||
GLC_Geometry::addPolyline(bottomWireData);
|
||||
GLC_Geometry::addVerticeGroup(bottomWireData);
|
||||
|
||||
// Set the material to use
|
||||
GLC_Material* pCylinderMaterial;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -229,7 +227,7 @@ void GLC_Cylinder::createMeshAndWire()
|
||||
normalsVector[3 * i + 1 + 3 * vertexNumber]= sinNormalArray[i];
|
||||
normalsVector[3 * i + 2 + 3 * vertexNumber]= 0.0f;
|
||||
|
||||
texelVector[2 * i + 2 * vertexNumber]= texelVector[i];
|
||||
texelVector[2 * i + 2 * vertexNumber]= texelVector[2 * i];
|
||||
texelVector[2 * i + 1 + 2 * vertexNumber]= 1.0f;
|
||||
|
||||
// Top Wire
|
||||
@ -248,7 +246,7 @@ void GLC_Cylinder::createMeshAndWire()
|
||||
normalsVector[3 * i + 1 + 2 * 3 * vertexNumber]= 0.0f;
|
||||
normalsVector[3 * i + 2 + 2 * 3 * vertexNumber]= -1.0f;
|
||||
|
||||
texelVector[2 * i + 2 * 2 * vertexNumber]= texelVector[i];
|
||||
texelVector[2 * i + 2 * 2 * vertexNumber]= texelVector[2 * i];
|
||||
texelVector[2 * i + 1 + 2 * 2 * vertexNumber]= 0.0f;
|
||||
|
||||
// Top Cap ends
|
||||
@ -260,8 +258,8 @@ void GLC_Cylinder::createMeshAndWire()
|
||||
normalsVector[3 * i + 1 + 3 * 3 * vertexNumber]= 0.0f;
|
||||
normalsVector[3 * i + 2 + 3 * 3 * vertexNumber]= 1.0f;
|
||||
|
||||
texelVector[2 * i + 3 * 2 * vertexNumber]= texelVector[i];
|
||||
texelVector[2 * i + 1 + 3 * 2 * vertexNumber]= 0.0f;
|
||||
texelVector[2 * i + 3 * 2 * vertexNumber]= texelVector[2 * i];
|
||||
texelVector[2 * i + 1 + 3 * 2 * vertexNumber]= 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@ -271,8 +269,8 @@ void GLC_Cylinder::createMeshAndWire()
|
||||
GLC_Mesh::addTexels(texelVector);
|
||||
|
||||
// Add polyline to wire data
|
||||
GLC_Geometry::addPolyline(bottomWireData);
|
||||
GLC_Geometry::addPolyline(topWireData);
|
||||
GLC_Geometry::addVerticeGroup(bottomWireData);
|
||||
GLC_Geometry::addVerticeGroup(topWireData);
|
||||
|
||||
// Set the material to use
|
||||
GLC_Material* pCylinderMaterial;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -193,7 +191,7 @@ void GLC_Disc::createMeshAndWire()
|
||||
GLC_Mesh::addTexels(texelVector);
|
||||
|
||||
// Add polyline to wire data
|
||||
GLC_Geometry::addPolyline(wireData);
|
||||
GLC_Geometry::addVerticeGroup(wireData);
|
||||
|
||||
// Set the material to use
|
||||
GLC_Material* pDiscMaterial;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -189,15 +187,15 @@ public:
|
||||
|
||||
//! Return the number of wire polylines
|
||||
inline int wirePolylineCount() const
|
||||
{return m_WireData.polylineCount();}
|
||||
{return m_WireData.verticeGroupCount();}
|
||||
|
||||
//! Return the polyline offset from the given index
|
||||
inline GLuint wirePolylineOffset(int index) const
|
||||
{return m_WireData.polylineOffset(index);}
|
||||
{return m_WireData.verticeGroupOffset(index);}
|
||||
|
||||
//! Return the polyline size from the given index
|
||||
inline GLsizei wirePolylineSize(int index) const
|
||||
{return m_WireData.polylineSize(index);}
|
||||
{return m_WireData.verticeGroupSize(index);}
|
||||
|
||||
//@}
|
||||
|
||||
@ -244,9 +242,9 @@ public:
|
||||
inline void setName(const QString name)
|
||||
{m_Name= name;}
|
||||
|
||||
//! Add a Polyline to the geometry and returns its id
|
||||
inline GLC_uint addPolyline(const GLfloatVector& vector)
|
||||
{return m_WireData.addPolyline(vector);}
|
||||
//! Add a vertice group to the geometry and returns its id
|
||||
inline GLC_uint addVerticeGroup(const GLfloatVector& vector)
|
||||
{return m_WireData.addVerticeGroup(vector);}
|
||||
|
||||
//! Set Line width
|
||||
inline void setLineWidth(GLfloat lineWidth)
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -167,8 +165,6 @@ QDataStream &operator>>(QDataStream &stream, GLC_Lod &lod)
|
||||
Q_ASSERT(chunckId == GLC_Lod::m_ChunkId);
|
||||
|
||||
stream >> lod.m_Accuracy;
|
||||
|
||||
QVector<GLuint> indexVector;
|
||||
stream >> lod.m_IndexVector;
|
||||
stream >> lod.m_TrianglesCount;
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -38,8 +36,8 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_LIB_EXPORT GLC_Lod
|
||||
{
|
||||
friend QDataStream &operator<<(QDataStream &, const GLC_Lod &);
|
||||
friend QDataStream &operator>>(QDataStream &, GLC_Lod &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_Lod &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_Lod &);
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -178,7 +176,7 @@ private:
|
||||
};
|
||||
|
||||
//! Non-member stream operator
|
||||
QDataStream &operator<<(QDataStream &, const GLC_Lod &);
|
||||
QDataStream &operator>>(QDataStream &, GLC_Lod &);
|
||||
GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_Lod &);
|
||||
GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_Lod &);
|
||||
|
||||
#endif /* GLC_LOD_H_ */
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -366,6 +364,97 @@ QList<QVector<GLuint> > GLC_Mesh::getFansIndex(int lod, GLC_uint materialId) con
|
||||
return result;
|
||||
}
|
||||
|
||||
GLC_Mesh* GLC_Mesh::createMeshOfGivenLod(int lodIndex)
|
||||
{
|
||||
Q_ASSERT(m_MeshData.lodCount() > lodIndex);
|
||||
|
||||
copyVboToClientSide();
|
||||
GLC_Mesh* pLodMesh= new GLC_Mesh;
|
||||
pLodMesh->setName(this->name() + "-LOD-" + QString::number(lodIndex));
|
||||
QHash<GLuint, GLuint> sourceToTargetIndexMap;
|
||||
QHash<GLuint, GLuint> tagetToSourceIndexMap;
|
||||
int maxIndex= -1;
|
||||
|
||||
int targetLod= 0;
|
||||
copyIndex(lodIndex, pLodMesh, sourceToTargetIndexMap, tagetToSourceIndexMap, maxIndex, targetLod);
|
||||
|
||||
copyBulkData(pLodMesh, tagetToSourceIndexMap, maxIndex);
|
||||
|
||||
pLodMesh->finish();
|
||||
|
||||
releaseVboClientSide(false);
|
||||
|
||||
return pLodMesh;
|
||||
}
|
||||
|
||||
GLC_Mesh* GLC_Mesh::createMeshFromGivenLod(int lodIndex)
|
||||
{
|
||||
const int lodCount= m_MeshData.lodCount();
|
||||
Q_ASSERT(lodCount > lodIndex);
|
||||
|
||||
copyVboToClientSide();
|
||||
GLC_Mesh* pLodMesh= new GLC_Mesh;
|
||||
pLodMesh->setName(this->name() + "-LOD-" + QString::number(lodIndex));
|
||||
QHash<GLuint, GLuint> sourceToTargetIndexMap;
|
||||
QHash<GLuint, GLuint> tagetToSourceIndexMap;
|
||||
int maxIndex= -1;
|
||||
|
||||
if ((lodCount - lodIndex) > 1)
|
||||
{
|
||||
int targetLod= 1;
|
||||
for (int i= lodIndex + 1; i < lodCount; ++i)
|
||||
{
|
||||
copyIndex(i, pLodMesh, sourceToTargetIndexMap, tagetToSourceIndexMap, maxIndex, targetLod);
|
||||
++targetLod;
|
||||
}
|
||||
copyIndex(lodIndex, pLodMesh, sourceToTargetIndexMap, tagetToSourceIndexMap, maxIndex, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
copyIndex(lodIndex, pLodMesh, sourceToTargetIndexMap, tagetToSourceIndexMap, maxIndex, 0);
|
||||
}
|
||||
|
||||
|
||||
copyBulkData(pLodMesh, tagetToSourceIndexMap, maxIndex);
|
||||
|
||||
pLodMesh->finish();
|
||||
|
||||
releaseVboClientSide(false);
|
||||
|
||||
return pLodMesh;
|
||||
}
|
||||
GLC_Mesh& GLC_Mesh::transformVertice(const GLC_Matrix4x4& matrix)
|
||||
{
|
||||
if (matrix.type() != GLC_Matrix4x4::Identity)
|
||||
{
|
||||
delete m_pBoundingBox;
|
||||
m_pBoundingBox= NULL;
|
||||
copyVboToClientSide();
|
||||
const int stride= 3;
|
||||
GLfloatVector* pVectPos= m_MeshData.positionVectorHandle();
|
||||
const GLC_Matrix4x4 rotationMatrix= matrix.rotationMatrix();
|
||||
GLfloatVector* pVectNormal= m_MeshData.normalVectorHandle();
|
||||
const int verticeCount= pVectPos->size() / stride;
|
||||
for (int i= 0; i < verticeCount; ++i)
|
||||
{
|
||||
GLC_Vector3d newPos(pVectPos->at(stride * i), pVectPos->at(stride * i + 1), pVectPos->at(stride * i + 2));
|
||||
newPos= matrix * newPos;
|
||||
pVectPos->operator[](stride * i)= static_cast<GLfloat>(newPos.x());
|
||||
pVectPos->operator[](stride * i + 1)= static_cast<GLfloat>(newPos.y());
|
||||
pVectPos->operator[](stride * i + 2)= static_cast<GLfloat>(newPos.z());
|
||||
|
||||
GLC_Vector3d newNormal(pVectNormal->at(stride * i), pVectNormal->at(stride * i + 1), pVectNormal->at(stride * i + 2));
|
||||
newNormal= rotationMatrix * newNormal;
|
||||
pVectNormal->operator[](stride * i)= static_cast<GLfloat>(newNormal.x());
|
||||
pVectNormal->operator[](stride * i + 1)= static_cast<GLfloat>(newNormal.y());
|
||||
pVectNormal->operator[](stride * i + 2)= static_cast<GLfloat>(newNormal.z());
|
||||
}
|
||||
releaseVboClientSide(true);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Set Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -847,12 +936,12 @@ void GLC_Mesh::glDraw(const GLC_RenderProperties& renderProperties)
|
||||
static_cast<float>(m_WireColor.alphaF())};
|
||||
|
||||
glColor4fv(color);
|
||||
m_WireData.glDraw(renderProperties);
|
||||
m_WireData.glDraw(renderProperties, GL_LINE_STRIP);
|
||||
glEnable(GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_WireData.glDraw(renderProperties);
|
||||
m_WireData.glDraw(renderProperties, GL_LINE_STRIP);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1246,3 +1335,143 @@ void GLC_Mesh::primitiveSelectedRenderLoop(const GLC_RenderProperties& renderPro
|
||||
}
|
||||
}
|
||||
|
||||
void GLC_Mesh::copyIndex(int lodIndex, GLC_Mesh* pLodMesh, QHash<GLuint, GLuint>& sourceToTargetIndexMap, QHash<GLuint, GLuint>& tagetToSourceIndexMap, int& maxIndex, int targetLod)
|
||||
{
|
||||
//! The list of LOD material ID
|
||||
QList<GLuint> materialId= m_PrimitiveGroups.value(lodIndex)->keys();
|
||||
|
||||
const int materialCount= materialId.size();
|
||||
for (int i= 0; i < materialCount; ++i)
|
||||
{
|
||||
GLuint currentMaterialId= materialId.at(i);
|
||||
GLC_Material* pCurrentMaterial= GLC_Geometry::material(currentMaterialId);
|
||||
|
||||
// Triangles
|
||||
if (containsTriangles(lodIndex, currentMaterialId))
|
||||
{
|
||||
QVector<GLuint> sourceTriangleIndex= getTrianglesIndex(lodIndex, currentMaterialId);
|
||||
QList<GLuint> targetTriangleIndex;
|
||||
const int triangleIndexCount= sourceTriangleIndex.size();
|
||||
for (int i= 0; i < triangleIndexCount; ++i)
|
||||
{
|
||||
const GLuint currentIndex= sourceTriangleIndex.at(i);
|
||||
if (!sourceToTargetIndexMap.contains(currentIndex))
|
||||
{
|
||||
sourceToTargetIndexMap.insert(currentIndex, ++maxIndex);
|
||||
tagetToSourceIndexMap.insert(maxIndex, currentIndex);
|
||||
targetTriangleIndex.append(maxIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetTriangleIndex.append(sourceToTargetIndexMap.value(currentIndex));
|
||||
}
|
||||
}
|
||||
pLodMesh->addTriangles(pCurrentMaterial, targetTriangleIndex, targetLod, m_MeshData.getLod(lodIndex)->accuracy());
|
||||
}
|
||||
|
||||
//Triangles strips
|
||||
if (containsStrips(lodIndex, currentMaterialId))
|
||||
{
|
||||
QList<QVector<GLuint> > sourceStripIndex= getStripsIndex(lodIndex, currentMaterialId);
|
||||
const int stripCount= sourceStripIndex.size();
|
||||
for (int stripIndex= 0; stripIndex < stripCount; ++stripIndex)
|
||||
{
|
||||
|
||||
QVector<GLuint> sourceTriangleStripIndex= sourceStripIndex.at(stripIndex);
|
||||
QList<GLuint> targetTriangleStripIndex;
|
||||
const int triangleStripIndexCount= sourceTriangleStripIndex.size();
|
||||
for (int i= 0; i < triangleStripIndexCount; ++i)
|
||||
{
|
||||
const GLuint currentIndex= sourceTriangleStripIndex.at(i);
|
||||
if (!sourceToTargetIndexMap.contains(currentIndex))
|
||||
{
|
||||
sourceToTargetIndexMap.insert(currentIndex, ++maxIndex);
|
||||
tagetToSourceIndexMap.insert(maxIndex, currentIndex);
|
||||
targetTriangleStripIndex.append(maxIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetTriangleStripIndex.append(sourceToTargetIndexMap.value(currentIndex));
|
||||
}
|
||||
}
|
||||
pLodMesh->addTrianglesStrip(pCurrentMaterial, targetTriangleStripIndex, targetLod, m_MeshData.getLod(lodIndex)->accuracy());
|
||||
}
|
||||
}
|
||||
//Triangles fans
|
||||
if (containsFans(lodIndex, currentMaterialId))
|
||||
{
|
||||
QList<QVector<GLuint> > sourceFanIndex= getFansIndex(lodIndex, currentMaterialId);
|
||||
const int fanCount= sourceFanIndex.size();
|
||||
for (int fanIndex= 0; fanIndex < fanCount; ++fanIndex)
|
||||
{
|
||||
|
||||
QVector<GLuint> sourceTriangleFanIndex= sourceFanIndex.at(fanIndex);
|
||||
QList<GLuint> targetTriangleFanIndex;
|
||||
const int triangleFanIndexCount= sourceTriangleFanIndex.size();
|
||||
for (int i= 0; i < triangleFanIndexCount; ++i)
|
||||
{
|
||||
const GLuint currentIndex= sourceTriangleFanIndex.at(i);
|
||||
if (!sourceToTargetIndexMap.contains(currentIndex))
|
||||
{
|
||||
sourceToTargetIndexMap.insert(currentIndex, ++maxIndex);
|
||||
tagetToSourceIndexMap.insert(maxIndex, currentIndex);
|
||||
targetTriangleFanIndex.append(maxIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetTriangleFanIndex.append(sourceToTargetIndexMap.value(currentIndex));
|
||||
}
|
||||
}
|
||||
pLodMesh->addTrianglesFan(pCurrentMaterial, targetTriangleFanIndex, targetLod, m_MeshData.getLod(lodIndex)->accuracy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GLC_Mesh::copyBulkData(GLC_Mesh* pLodMesh, const QHash<GLuint, GLuint>& tagetToSourceIndexMap, int maxIndex)
|
||||
{
|
||||
GLfloatVector tempFloatVector;
|
||||
int stride= 3;
|
||||
// Extract position bulk data
|
||||
Q_ASSERT(!m_MeshData.positionVectorHandle()->isEmpty());
|
||||
tempFloatVector.resize(stride * (maxIndex + 1));
|
||||
for (int i= 0; i < maxIndex + 1; ++i)
|
||||
{
|
||||
GLfloat* pTarget= &(tempFloatVector.data()[i * stride]);
|
||||
GLfloat* pSource= &(m_MeshData.positionVectorHandle()->data()[tagetToSourceIndexMap.value(i) * stride]);
|
||||
|
||||
memcpy(pTarget, pSource, sizeof(GLfloat) * stride);
|
||||
}
|
||||
pLodMesh->addVertice(tempFloatVector);
|
||||
tempFloatVector.clear();
|
||||
|
||||
// Extract normal bulk data
|
||||
Q_ASSERT(!m_MeshData.normalVectorHandle()->isEmpty());
|
||||
tempFloatVector.resize(stride * (maxIndex + 1));
|
||||
for (int i= 0; i < maxIndex + 1; ++i)
|
||||
{
|
||||
GLfloat* pTarget= &(tempFloatVector.data()[i * stride]);
|
||||
GLfloat* pSource= &(m_MeshData.normalVectorHandle()->data()[tagetToSourceIndexMap.value(i) * stride]);
|
||||
|
||||
memcpy(pTarget, pSource, sizeof(GLfloat) * stride);
|
||||
}
|
||||
pLodMesh->addNormals(tempFloatVector);
|
||||
tempFloatVector.clear();
|
||||
|
||||
if (!m_MeshData.texelVectorHandle()->isEmpty())
|
||||
{
|
||||
// Extract texel bulk data
|
||||
stride= 2;
|
||||
tempFloatVector.resize(stride * (maxIndex + 1));
|
||||
|
||||
for (int i= 0; i < maxIndex + 1; ++i)
|
||||
{
|
||||
GLfloat* pTarget= &(tempFloatVector.data()[i * stride]);
|
||||
GLfloat* pSource= &(m_MeshData.texelVectorHandle()->data()[tagetToSourceIndexMap.value(i) * stride]);
|
||||
|
||||
memcpy(pTarget, pSource, sizeof(GLfloat) * stride);
|
||||
}
|
||||
pLodMesh->addTexels(tempFloatVector);
|
||||
tempFloatVector.clear();
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -152,7 +150,7 @@ public:
|
||||
inline bool containsLod(int lod) const
|
||||
{return (NULL != m_MeshData.getLod(lod));}
|
||||
|
||||
//! Return true if the specified LOD conatins the specified material
|
||||
//! Return true if the specified LOD contains the specified material
|
||||
inline bool lodContainsMaterial(int lod, GLC_uint materialId) const
|
||||
{
|
||||
if (!m_PrimitiveGroups.contains(lod))return false;
|
||||
@ -179,6 +177,16 @@ public:
|
||||
inline QColor wireColor() const
|
||||
{return m_WireColor;}
|
||||
|
||||
//! Create a mesh of the given LOD index
|
||||
GLC_Mesh* createMeshOfGivenLod(int lodIndex);
|
||||
|
||||
//! Create a mesh from the given LOD index
|
||||
GLC_Mesh* createMeshFromGivenLod(int lodIndex);
|
||||
|
||||
|
||||
//! Transform mesh vertice by the given matrix
|
||||
GLC_Mesh& transformVertice(const GLC_Matrix4x4& matrix);
|
||||
|
||||
//@}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Set Functions*/
|
||||
@ -357,6 +365,12 @@ private:
|
||||
//! The primitive Selected render loop
|
||||
void primitiveSelectedRenderLoop(const GLC_RenderProperties&, bool);
|
||||
|
||||
//! Copy index of this mesh from the given LOD into the given mesh
|
||||
void copyIndex(int lod, GLC_Mesh* pLodMesh, QHash<GLuint, GLuint>& sourceToTargetIndexMap, QHash<GLuint, GLuint>& tagetToSourceIndexMap, int& maxIndex, int targetLod);
|
||||
|
||||
//! Copy Bulk data
|
||||
void copyBulkData(GLC_Mesh* pLodMesh, const QHash<GLuint, GLuint>& tagetToSourceIndexMap, int maxIndex);
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -458,10 +456,10 @@ QDataStream &operator>>(QDataStream &stream, GLC_MeshData &meshData)
|
||||
|
||||
GLfloatVector position, normal, texel, color;
|
||||
|
||||
stream >> *(meshData.positionVectorHandle());
|
||||
stream >> *(meshData.normalVectorHandle());
|
||||
stream >> *(meshData.texelVectorHandle());
|
||||
stream >> *(meshData.colorVectorHandle());
|
||||
stream >> meshData.m_Positions;
|
||||
stream >> meshData.m_Normals;
|
||||
stream >> meshData.m_Texels;
|
||||
stream >> meshData.m_Colors;
|
||||
|
||||
// List of lod serialisation
|
||||
QList<GLC_Lod> lodsList;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -42,8 +40,8 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_LIB_EXPORT GLC_MeshData
|
||||
{
|
||||
friend QDataStream &operator<<(QDataStream &, const GLC_MeshData &);
|
||||
friend QDataStream &operator>>(QDataStream &, GLC_MeshData &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_MeshData &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_MeshData &);
|
||||
|
||||
public:
|
||||
|
||||
@ -256,7 +254,7 @@ private:
|
||||
};
|
||||
|
||||
//! Non-member stream operator
|
||||
QDataStream &operator<<(QDataStream &, const GLC_MeshData &);
|
||||
QDataStream &operator>>(QDataStream &, GLC_MeshData &);
|
||||
GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_MeshData &);
|
||||
GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_MeshData &);
|
||||
|
||||
#endif /* GLC_MESHDATA_H_ */
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -34,13 +32,17 @@ using namespace glc;
|
||||
|
||||
|
||||
GLC_Point::GLC_Point(const GLC_Point3d &setCoord)
|
||||
:GLC_Geometry("Point", true), m_Coordinate(setCoord)
|
||||
:GLC_Geometry("Point", true)
|
||||
, m_Coordinate(setCoord)
|
||||
, m_Size(1.0f)
|
||||
{
|
||||
|
||||
}
|
||||
//! Construct an GLC_Point
|
||||
GLC_Point::GLC_Point(double x, double y, double z)
|
||||
:GLC_Geometry("Point", true), m_Coordinate(x, y, z)
|
||||
:GLC_Geometry("Point", true)
|
||||
, m_Coordinate(x, y, z)
|
||||
, m_Size(1.0f)
|
||||
{
|
||||
}
|
||||
|
||||
@ -101,10 +103,12 @@ void GLC_Point::setCoordinate(double x, double y, double z)
|
||||
|
||||
void GLC_Point::glDraw(const GLC_RenderProperties&)
|
||||
{
|
||||
glPointSize(m_Size);
|
||||
// Point Display
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3dv(m_Coordinate.data());
|
||||
glEnd();
|
||||
glPointSize(1.0f);
|
||||
|
||||
// OpenGL error handler
|
||||
GLenum error= glGetError();
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -68,6 +66,10 @@ public:
|
||||
//! Return a copy of the geometry
|
||||
virtual GLC_Geometry* clone() const;
|
||||
|
||||
//! Return the size of this point
|
||||
inline GLfloat size() const
|
||||
{return m_Size;}
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -80,6 +82,11 @@ public:
|
||||
|
||||
//! Set Point coordinate by 3 double
|
||||
void setCoordinate(double x, double y, double z);
|
||||
|
||||
//! Set the size of this point
|
||||
void setSize(GLfloat size)
|
||||
{m_Size= size;}
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -99,8 +106,11 @@ private:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
private:
|
||||
//! 4d point for point coordinate
|
||||
//! Point for point coordinate
|
||||
GLC_Point3d m_Coordinate;
|
||||
|
||||
//! Size of the point
|
||||
GLfloat m_Size;
|
||||
|
||||
};
|
||||
#endif //GLC_POINT_H_
|
||||
|
118
ground/openpilotgcs/src/libs/glc_lib/geometry/glc_pointcloud.cpp
Normal file
118
ground/openpilotgcs/src/libs/glc_lib/geometry/glc_pointcloud.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
//! \file glc_pointcloud.cpp implementation of the GLC_PointCloud class.
|
||||
|
||||
#include "glc_pointcloud.h"
|
||||
|
||||
GLC_PointCloud::GLC_PointCloud()
|
||||
: GLC_Geometry("Point Cloud", true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GLC_PointCloud::GLC_PointCloud(const GLC_PointCloud& pointCloud)
|
||||
: GLC_Geometry(pointCloud)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
GLC_PointCloud::~GLC_PointCloud()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Get Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
const GLC_BoundingBox& GLC_PointCloud::boundingBox()
|
||||
{
|
||||
if (NULL == GLC_Geometry::m_pBoundingBox)
|
||||
{
|
||||
GLC_Geometry::m_pBoundingBox= new GLC_BoundingBox();
|
||||
if (! m_WireData.isEmpty())
|
||||
{
|
||||
GLC_Geometry::m_pBoundingBox->combine(m_WireData.boundingBox());
|
||||
}
|
||||
}
|
||||
return *GLC_Geometry::m_pBoundingBox;
|
||||
}
|
||||
|
||||
GLC_Geometry* GLC_PointCloud::clone() const
|
||||
{
|
||||
return new GLC_PointCloud(*this);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Set Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
GLC_uint GLC_PointCloud::addPoint(const QList<GLC_Point3d>& pointsList)
|
||||
{
|
||||
const int pointCount= pointsList.size();
|
||||
const int size= pointCount * 3;
|
||||
GLfloatVector data(size);
|
||||
for (int i= 0; i < pointCount; ++i)
|
||||
{
|
||||
const GLC_Point3d currentPoint(pointsList.at(i));
|
||||
data[i * 3]= static_cast<float>(currentPoint.x());
|
||||
data[i * 3 + 1]= static_cast<float>(currentPoint.y());
|
||||
data[i * 3 + 2]= static_cast<float>(currentPoint.z());
|
||||
}
|
||||
return GLC_Geometry::m_WireData.addVerticeGroup(data);
|
||||
}
|
||||
|
||||
GLC_uint GLC_PointCloud::addPoint(const QList<GLC_Point3df>& pointsList)
|
||||
{
|
||||
const int pointCount= pointsList.size();
|
||||
const int size= pointCount * 3;
|
||||
GLfloatVector data(size);
|
||||
for (int i= 0; i < pointCount; ++i)
|
||||
{
|
||||
const GLC_Point3df currentPoint(pointsList.at(i));
|
||||
data[i * 3]= currentPoint.x();
|
||||
data[i * 3 + 1]= currentPoint.y();
|
||||
data[i * 3 + 2]= currentPoint.z();
|
||||
}
|
||||
return GLC_Geometry::m_WireData.addVerticeGroup(data);
|
||||
}
|
||||
|
||||
GLC_PointCloud& GLC_PointCloud::operator=(const GLC_PointCloud& pointCloud)
|
||||
{
|
||||
if (this != &pointCloud)
|
||||
{
|
||||
GLC_Geometry::operator=(pointCloud);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void GLC_PointCloud::glDraw(const GLC_RenderProperties& renderProperties)
|
||||
{
|
||||
if (!GLC_Geometry::m_WireData.isEmpty())
|
||||
{
|
||||
GLC_Geometry::m_WireData.glDraw(renderProperties, GL_POINTS);
|
||||
}
|
||||
}
|
||||
|
113
ground/openpilotgcs/src/libs/glc_lib/geometry/glc_pointcloud.h
Normal file
113
ground/openpilotgcs/src/libs/glc_lib/geometry/glc_pointcloud.h
Normal file
@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
//! \file glc_pointcloud.h interface for the GLC_PointCloud class.
|
||||
|
||||
#ifndef GLC_POINTCLOUD_H_
|
||||
#define GLC_POINTCLOUD_H_
|
||||
|
||||
#include "glc_geometry.h"
|
||||
#include "../maths/glc_vector3d.h"
|
||||
#include "../maths/glc_vector3df.h"
|
||||
|
||||
#include "../glc_config.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//! \class GLC_PointCloud
|
||||
/*! \brief GLC_PointCloud : OpenGL 3D cloud of points*/
|
||||
|
||||
/*! An GLC_PointCloud is a group of points
|
||||
* All points of this class have the same color*/
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_LIB_EXPORT GLC_PointCloud : public GLC_Geometry
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! @name Constructor / Destructor */
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
public:
|
||||
//! Construct an empty cloud of points
|
||||
GLC_PointCloud();
|
||||
|
||||
//! Copy constructor
|
||||
GLC_PointCloud(const GLC_PointCloud& pointCloud);
|
||||
|
||||
//! Destructor
|
||||
virtual ~GLC_PointCloud();
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Get Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
//! Return the point cloud bounding box
|
||||
const GLC_BoundingBox& boundingBox();
|
||||
|
||||
//! Return a copy of the geometry
|
||||
virtual GLC_Geometry* clone() const;
|
||||
|
||||
//! Return true if this point cloud is empty
|
||||
inline bool isEmpty() const
|
||||
{return GLC_Geometry::m_WireData.isEmpty();}
|
||||
|
||||
//@}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Set Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
//! Add a point to this wire and returns its id if id are managed
|
||||
inline GLC_uint addPoint(const GLfloatVector& data)
|
||||
{return GLC_Geometry::m_WireData.addVerticeGroup(data);}
|
||||
|
||||
//! Add the given list of points to this cloud and returns its id if id are managed
|
||||
GLC_uint addPoint(const QList<GLC_Point3d>& pointsList);
|
||||
|
||||
//! Add the given list of points to this cloud and returns its id if id are managed
|
||||
GLC_uint addPoint(const QList<GLC_Point3df>& pointsList);
|
||||
|
||||
//! Set this point cloud from the given point cloud and return a reference of this point cloud
|
||||
GLC_PointCloud& operator=(const GLC_PointCloud& pointcloud);
|
||||
|
||||
//! Clear the content of this point cloud Data and makes it empty
|
||||
inline void clear()
|
||||
{GLC_Geometry::m_WireData.clear();}
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name OpenGL Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
private:
|
||||
|
||||
//! Virtual interface for OpenGL Geometry set up.
|
||||
/*! This Virtual function is implemented here.\n
|
||||
* Throw GLC_OpenGlException*/
|
||||
virtual void glDraw(const GLC_RenderProperties&);
|
||||
|
||||
//@}
|
||||
|
||||
};
|
||||
|
||||
#endif /* GLC_POINTCLOUD_H_ */
|
@ -3,8 +3,6 @@
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Copyright (C) 2009 Laurent Bauer
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -28,6 +26,7 @@
|
||||
#include "../glc_openglexception.h"
|
||||
#include "../glc_state.h"
|
||||
#include "../glc_ext.h"
|
||||
#include "../shading/glc_selectionmaterial.h"
|
||||
|
||||
// The maximum point size
|
||||
float GLC_PointSprite::m_MaxSize= -1.0f;
|
||||
@ -120,14 +119,23 @@ void GLC_PointSprite::render(const GLC_RenderProperties& renderProperties)
|
||||
|
||||
if(m_MaterialHash.size() == 1)
|
||||
{
|
||||
GLC_Material* pCurrentMaterial= m_MaterialHash.begin().value();
|
||||
const GLfloat red= pCurrentMaterial->diffuseColor().redF();
|
||||
const GLfloat green= pCurrentMaterial->diffuseColor().greenF();
|
||||
const GLfloat blue= pCurrentMaterial->diffuseColor().blueF();
|
||||
const GLfloat alpha= pCurrentMaterial->diffuseColor().alphaF();
|
||||
|
||||
glColor4f(red, green, blue, alpha);
|
||||
pCurrentMaterial->glExecute();
|
||||
if (renderProperties.isSelected())
|
||||
{
|
||||
GLC_SelectionMaterial::glExecute();
|
||||
}
|
||||
else
|
||||
{
|
||||
GLC_Material* pCurrentMaterial= m_MaterialHash.begin().value();
|
||||
const GLfloat red= pCurrentMaterial->diffuseColor().redF();
|
||||
const GLfloat green= pCurrentMaterial->diffuseColor().greenF();
|
||||
const GLfloat blue= pCurrentMaterial->diffuseColor().blueF();
|
||||
const GLfloat alpha= pCurrentMaterial->diffuseColor().alphaF();
|
||||
|
||||
glColor4f(red, green, blue, alpha);
|
||||
pCurrentMaterial->glExecute();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3,8 +3,6 @@
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Copyright (C) 2009 Laurent Bauer
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -82,7 +80,7 @@ void GLC_Polylines::glDraw(const GLC_RenderProperties& renderProperties)
|
||||
{
|
||||
if (!GLC_Geometry::m_WireData.isEmpty())
|
||||
{
|
||||
GLC_Geometry::m_WireData.glDraw(renderProperties);
|
||||
GLC_Geometry::m_WireData.glDraw(renderProperties, GL_LINE_STRIP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -78,7 +76,7 @@ public:
|
||||
public:
|
||||
//! Add a Polyline to this wire and returns its id if id are managed
|
||||
inline GLC_uint addPolyline(const GLfloatVector& data)
|
||||
{return GLC_Geometry::m_WireData.addPolyline(data);}
|
||||
{return GLC_Geometry::m_WireData.addVerticeGroup(data);}
|
||||
|
||||
//! Set this polylines from the given polylines and return a reference of this polylines
|
||||
GLC_Polylines& operator=(const GLC_Polylines& polyline);
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -41,8 +39,8 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_LIB_EXPORT GLC_PrimitiveGroup
|
||||
{
|
||||
friend QDataStream &operator<<(QDataStream &, const GLC_PrimitiveGroup &);
|
||||
friend QDataStream &operator>>(QDataStream &, GLC_PrimitiveGroup &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_PrimitiveGroup &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_PrimitiveGroup &);
|
||||
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -314,7 +312,7 @@ private:
|
||||
};
|
||||
|
||||
//! Non-member stream operator
|
||||
QDataStream &operator<<(QDataStream &, const GLC_PrimitiveGroup &);
|
||||
QDataStream &operator>>(QDataStream &, GLC_PrimitiveGroup &);
|
||||
GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_PrimitiveGroup &);
|
||||
GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_PrimitiveGroup &);
|
||||
|
||||
#endif /* GLC_PRIMITIVEGROUP_H_ */
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -159,7 +157,7 @@ void GLC_Rectangle::createMeshAndWire()
|
||||
|
||||
// Add the first point of the rectangle for wire
|
||||
verticeVector << -lgX; verticeVector << -lgY; verticeVector << 0.0f;
|
||||
GLC_Geometry::addPolyline(verticeVector);
|
||||
GLC_Geometry::addVerticeGroup(verticeVector);
|
||||
|
||||
// Set the material to use
|
||||
GLC_Material* pMaterial;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -23,6 +21,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "glc_rep.h"
|
||||
#include "QtDebug"
|
||||
|
||||
// Default constructor
|
||||
GLC_Rep::GLC_Rep()
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -3,8 +3,6 @@
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2010 Laurent Bauer
|
||||
Copyright (C) 2010 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -3,8 +3,6 @@
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2010 Laurent Bauer
|
||||
Copyright (C) 2010 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -38,10 +36,10 @@ GLC_WireData::GLC_WireData()
|
||||
, m_Positions()
|
||||
, m_PositionSize(0)
|
||||
, m_pBoundingBox(NULL)
|
||||
, m_PolylinesSizes()
|
||||
, m_PolylinesOffset()
|
||||
, m_PolylinesId()
|
||||
, m_PolylinesCount(0)
|
||||
, m_VerticeGrouprSizes()
|
||||
, m_VerticeGroupOffset()
|
||||
, m_VerticeGroupId()
|
||||
, m_VerticeGroupCount(0)
|
||||
{
|
||||
|
||||
}
|
||||
@ -53,10 +51,10 @@ GLC_WireData::GLC_WireData(const GLC_WireData& data)
|
||||
, m_Positions(data.positionVector())
|
||||
, m_PositionSize(data.m_PositionSize)
|
||||
, m_pBoundingBox(NULL)
|
||||
, m_PolylinesSizes(data.m_PolylinesSizes)
|
||||
, m_PolylinesOffset(data.m_PolylinesOffset)
|
||||
, m_PolylinesId(data.m_PolylinesId)
|
||||
, m_PolylinesCount(data.m_PolylinesCount)
|
||||
, m_VerticeGrouprSizes(data.m_VerticeGrouprSizes)
|
||||
, m_VerticeGroupOffset(data.m_VerticeGroupOffset)
|
||||
, m_VerticeGroupId(data.m_VerticeGroupId)
|
||||
, m_VerticeGroupCount(data.m_VerticeGroupCount)
|
||||
{
|
||||
if (NULL != data.m_pBoundingBox)
|
||||
{
|
||||
@ -77,10 +75,10 @@ GLC_WireData& GLC_WireData::operator=(const GLC_WireData& data)
|
||||
{
|
||||
m_pBoundingBox= new GLC_BoundingBox(*(data.m_pBoundingBox));
|
||||
}
|
||||
m_PolylinesSizes= data.m_PolylinesSizes;
|
||||
m_PolylinesOffset= data.m_PolylinesOffset;
|
||||
m_PolylinesId= data.m_PolylinesId;
|
||||
m_PolylinesCount= data.m_PolylinesCount;
|
||||
m_VerticeGrouprSizes= data.m_VerticeGrouprSizes;
|
||||
m_VerticeGroupOffset= data.m_VerticeGroupOffset;
|
||||
m_VerticeGroupId= data.m_VerticeGroupId;
|
||||
m_VerticeGroupCount= data.m_VerticeGroupCount;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -159,24 +157,24 @@ GLC_BoundingBox& GLC_WireData::boundingBox()
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
GLC_uint GLC_WireData::addPolyline(const GLfloatVector& floatVector)
|
||||
GLC_uint GLC_WireData::addVerticeGroup(const GLfloatVector& floatVector)
|
||||
{
|
||||
Q_ASSERT((floatVector.size() % 3) == 0);
|
||||
|
||||
++m_PolylinesCount;
|
||||
++m_VerticeGroupCount;
|
||||
m_Positions+= floatVector;
|
||||
|
||||
m_PolylinesSizes.append(static_cast<GLsizei>(floatVector.size() / 3));
|
||||
m_VerticeGrouprSizes.append(static_cast<GLsizei>(floatVector.size() / 3));
|
||||
|
||||
if (m_PolylinesOffset.isEmpty())
|
||||
if (m_VerticeGroupOffset.isEmpty())
|
||||
{
|
||||
m_PolylinesOffset.append(0);
|
||||
m_VerticeGroupOffset.append(0);
|
||||
}
|
||||
int offset= m_PolylinesOffset.last() + m_PolylinesSizes.last();
|
||||
m_PolylinesOffset.append(offset);
|
||||
int offset= m_VerticeGroupOffset.last() + m_VerticeGrouprSizes.last();
|
||||
m_VerticeGroupOffset.append(offset);
|
||||
|
||||
// The Polyline id
|
||||
m_PolylinesId.append(m_NextPrimitiveLocalId);
|
||||
m_VerticeGroupId.append(m_NextPrimitiveLocalId);
|
||||
return m_NextPrimitiveLocalId++;
|
||||
}
|
||||
|
||||
@ -188,10 +186,10 @@ void GLC_WireData::clear()
|
||||
delete m_pBoundingBox;
|
||||
m_pBoundingBox= NULL;
|
||||
|
||||
m_PolylinesSizes.clear();
|
||||
m_PolylinesOffset.clear();
|
||||
m_PolylinesId.clear();
|
||||
m_PolylinesCount= 0;
|
||||
m_VerticeGrouprSizes.clear();
|
||||
m_VerticeGroupOffset.clear();
|
||||
m_VerticeGroupId.clear();
|
||||
m_VerticeGroupCount= 0;
|
||||
}
|
||||
|
||||
void GLC_WireData::copyVboToClientSide()
|
||||
@ -238,7 +236,7 @@ void GLC_WireData::useVBO(bool use)
|
||||
}
|
||||
}
|
||||
|
||||
void GLC_WireData::glDraw(const GLC_RenderProperties&)
|
||||
void GLC_WireData::glDraw(const GLC_RenderProperties&, GLenum mode)
|
||||
{
|
||||
Q_ASSERT(!isEmpty());
|
||||
const bool vboIsUsed= GLC_State::vboUsed();
|
||||
@ -265,9 +263,9 @@ void GLC_WireData::glDraw(const GLC_RenderProperties&)
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
// Render polylines
|
||||
for (int i= 0; i < m_PolylinesCount; ++i)
|
||||
for (int i= 0; i < m_VerticeGroupCount; ++i)
|
||||
{
|
||||
glDrawArrays(GL_LINE_STRIP, m_PolylinesOffset.at(i), m_PolylinesSizes.at(i));
|
||||
glDrawArrays(mode, m_VerticeGroupOffset.at(i), m_VerticeGrouprSizes.at(i));
|
||||
}
|
||||
|
||||
// Desactivate VBO or Vertex Array
|
||||
@ -304,10 +302,10 @@ QDataStream &operator<<(QDataStream &stream, const GLC_WireData &wireData)
|
||||
stream << wireData.positionVector();
|
||||
stream << wireData.m_PositionSize;
|
||||
|
||||
stream << wireData.m_PolylinesSizes;
|
||||
stream << wireData.m_PolylinesOffset;
|
||||
stream << wireData.m_PolylinesId;
|
||||
stream << wireData.m_PolylinesCount;
|
||||
stream << wireData.m_VerticeGrouprSizes;
|
||||
stream << wireData.m_VerticeGroupOffset;
|
||||
stream << wireData.m_VerticeGroupId;
|
||||
stream << wireData.m_VerticeGroupCount;
|
||||
|
||||
return stream;
|
||||
}
|
||||
@ -323,10 +321,10 @@ QDataStream &operator>>(QDataStream &stream, GLC_WireData &wireData)
|
||||
stream >> wireData.m_Positions;
|
||||
stream >> wireData.m_PositionSize;
|
||||
|
||||
stream >> wireData.m_PolylinesSizes;
|
||||
stream >> wireData.m_PolylinesOffset;
|
||||
stream >> wireData.m_PolylinesId;
|
||||
stream >> wireData.m_PolylinesCount;
|
||||
stream >> wireData.m_VerticeGrouprSizes;
|
||||
stream >> wireData.m_VerticeGroupOffset;
|
||||
stream >> wireData.m_VerticeGroupId;
|
||||
stream >> wireData.m_VerticeGroupCount;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -39,8 +37,8 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_LIB_EXPORT GLC_WireData
|
||||
{
|
||||
friend QDataStream &operator<<(QDataStream &, const GLC_WireData &);
|
||||
friend QDataStream &operator>>(QDataStream &, GLC_WireData &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_WireData &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_WireData &);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! @name Constructor / Destructor */
|
||||
@ -78,17 +76,17 @@ public:
|
||||
//! Return this wire data bounding box
|
||||
GLC_BoundingBox& boundingBox();
|
||||
|
||||
//! Return the number of polylines
|
||||
inline int polylineCount() const
|
||||
{return m_PolylinesCount;}
|
||||
//! Return the number of vertice group
|
||||
inline int verticeGroupCount() const
|
||||
{return m_VerticeGroupCount;}
|
||||
|
||||
//! Return the polyline offset from the given index
|
||||
inline GLuint polylineOffset(int index) const
|
||||
{return m_PolylinesOffset.at(index);}
|
||||
//! Return the vertice group offset from the given index
|
||||
inline GLuint verticeGroupOffset(int index) const
|
||||
{return m_VerticeGroupOffset.at(index);}
|
||||
|
||||
//! Return the polyline size from the given index
|
||||
inline GLsizei polylineSize(int index) const
|
||||
{return m_PolylinesSizes.at(index);}
|
||||
//! Return the vertice group size from the given index
|
||||
inline GLsizei verticeGroupSize(int index) const
|
||||
{return m_VerticeGrouprSizes.at(index);}
|
||||
|
||||
//@}
|
||||
|
||||
@ -98,7 +96,7 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
//! Add a Polyline to this wire and returns its id if id are managed
|
||||
GLC_uint addPolyline(const GLfloatVector&);
|
||||
GLC_uint addVerticeGroup(const GLfloatVector&);
|
||||
|
||||
//! Clear the content of this wire Data and makes it empty
|
||||
void clear();
|
||||
@ -123,7 +121,8 @@ public:
|
||||
void useVBO(bool usage);
|
||||
|
||||
//! Render this wire data using Opengl
|
||||
void glDraw(const GLC_RenderProperties&);
|
||||
/*! The mode can be : GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP GL_LINES*/
|
||||
void glDraw(const GLC_RenderProperties&, GLenum mode);
|
||||
|
||||
private:
|
||||
//! Create this wire data VBO id
|
||||
@ -152,24 +151,24 @@ private:
|
||||
//! Wire data bounding box
|
||||
GLC_BoundingBox* m_pBoundingBox;
|
||||
|
||||
//! Polylines size
|
||||
IndexSizes m_PolylinesSizes;
|
||||
//! Vector of Vertice group size
|
||||
IndexSizes m_VerticeGrouprSizes;
|
||||
|
||||
//! Vector of polyline group offset
|
||||
OffsetVectori m_PolylinesOffset;
|
||||
//! Vector of vertice group offset
|
||||
OffsetVectori m_VerticeGroupOffset;
|
||||
|
||||
//! Polyline groups id
|
||||
QList<GLC_uint> m_PolylinesId;
|
||||
//! Vertice groups id
|
||||
QList<GLC_uint> m_VerticeGroupId;
|
||||
|
||||
//! The number of polylines
|
||||
int m_PolylinesCount;
|
||||
//! The number of vertice group
|
||||
int m_VerticeGroupCount;
|
||||
|
||||
//! Class chunk id
|
||||
static quint32 m_ChunkId;
|
||||
};
|
||||
|
||||
//! Non-member stream operator
|
||||
QDataStream &operator<<(QDataStream &, const GLC_WireData &);
|
||||
QDataStream &operator>>(QDataStream &, GLC_WireData &);
|
||||
GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_WireData &);
|
||||
GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_WireData &);
|
||||
|
||||
#endif /* GLC_WIREDATA_H_ */
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -172,11 +170,35 @@ GLC_BoundingBox& GLC_BoundingBox::transform(const GLC_Matrix4x4& matrix)
|
||||
{
|
||||
if (!m_IsEmpty)
|
||||
{
|
||||
GLC_Point3d newLower= matrix * m_Lower;
|
||||
GLC_Point3d newUpper= matrix * m_Upper;
|
||||
// Compute Transformed BoundingBox Corner
|
||||
GLC_Point3d corner1(m_Lower);
|
||||
GLC_Point3d corner7(m_Upper);
|
||||
GLC_Point3d corner2(corner7.x(), corner1.y(), corner1.z());
|
||||
GLC_Point3d corner3(corner7.x(), corner7.y(), corner1.z());
|
||||
GLC_Point3d corner4(corner1.x(), corner7.y(), corner1.z());
|
||||
GLC_Point3d corner5(corner1.x(), corner1.y(), corner7.z());
|
||||
GLC_Point3d corner6(corner7.x(), corner1.y(), corner7.z());
|
||||
GLC_Point3d corner8(corner1.x(), corner7.y(), corner7.z());
|
||||
|
||||
corner1 = (matrix * corner1);
|
||||
corner2 = (matrix * corner2);
|
||||
corner3 = (matrix * corner3);
|
||||
corner4 = (matrix * corner4);
|
||||
corner5 = (matrix * corner5);
|
||||
corner6 = (matrix * corner6);
|
||||
corner7 = (matrix * corner7);
|
||||
corner8 = (matrix * corner8);
|
||||
|
||||
// Compute the new BoundingBox
|
||||
GLC_BoundingBox boundingBox;
|
||||
boundingBox.combine(newLower);
|
||||
boundingBox.combine(newUpper);
|
||||
boundingBox.combine(corner1);
|
||||
boundingBox.combine(corner2);
|
||||
boundingBox.combine(corner3);
|
||||
boundingBox.combine(corner4);
|
||||
boundingBox.combine(corner5);
|
||||
boundingBox.combine(corner6);
|
||||
boundingBox.combine(corner7);
|
||||
boundingBox.combine(corner8);
|
||||
|
||||
m_Lower= boundingBox.m_Lower;
|
||||
m_Upper= boundingBox.m_Upper;
|
||||
@ -191,8 +213,8 @@ QDataStream &operator<<(QDataStream &stream, const GLC_BoundingBox &bBox)
|
||||
stream << chunckId;
|
||||
|
||||
stream << bBox.m_IsEmpty;
|
||||
stream << bBox.lowerCorner();
|
||||
stream << bBox.upperCorner();
|
||||
stream << bBox.m_Lower;
|
||||
stream << bBox.m_Upper;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -44,8 +42,8 @@
|
||||
|
||||
class GLC_LIB_EXPORT GLC_BoundingBox
|
||||
{
|
||||
friend QDataStream &operator<<(QDataStream &, const GLC_BoundingBox &);
|
||||
friend QDataStream &operator>>(QDataStream &, GLC_BoundingBox &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_BoundingBox &);
|
||||
friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_BoundingBox &);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! @name Constructor */
|
||||
@ -162,8 +160,8 @@ private:
|
||||
};
|
||||
|
||||
//! Non-member stream operator
|
||||
QDataStream &operator<<(QDataStream &, const GLC_BoundingBox &);
|
||||
QDataStream &operator>>(QDataStream &, GLC_BoundingBox &);
|
||||
GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_BoundingBox &);
|
||||
GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_BoundingBox &);
|
||||
|
||||
// Return true if the given bounding box intersect this bounding box
|
||||
bool GLC_BoundingBox::intersect(const GLC_BoundingBox& boundingBox) const
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -115,18 +113,9 @@ bool GLC_CacheManager::isUsable(const QDateTime& timeStamp, const QString& conte
|
||||
{
|
||||
GLC_BSRep binaryRep;
|
||||
binaryRep.setAbsoluteFileName(cacheFileInfo.absoluteFilePath());
|
||||
result= result && binaryRep.repIsUpToDate(timeStamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "file " << fileName << " not usable";
|
||||
result= result && binaryRep.isUsable(timeStamp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileInfo cacheFileInfo(m_Dir.absolutePath() + QDir::separator() + context + QDir::separator() + fileName+ '.' + GLC_BSRep::suffix());
|
||||
}
|
||||
if (! result) qDebug() << "NOT USABLE";
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -134,7 +123,7 @@ bool GLC_CacheManager::isUsable(const QDateTime& timeStamp, const QString& conte
|
||||
// Return the binary serialized representation of the specified file
|
||||
GLC_BSRep GLC_CacheManager::binary3DRep(const QString& context, const QString& fileName) const
|
||||
{
|
||||
const QString absoluteFileName(m_Dir.absolutePath() + QDir::separator() + context + QDir::separator() + fileName+ '.' + GLC_BSRep::suffix());
|
||||
const QString absoluteFileName(m_Dir.absolutePath() + QDir::separator() + context + QDir::separator() + fileName + '.' + GLC_BSRep::suffix());
|
||||
GLC_BSRep binaryRep(absoluteFileName);
|
||||
|
||||
return binaryRep;
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
97
ground/openpilotgcs/src/libs/glc_lib/glc_errorlog.cpp
Normal file
97
ground/openpilotgcs/src/libs/glc_lib/glc_errorlog.cpp
Normal file
@ -0,0 +1,97 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
//! \file glc_errorlog.h implementation of the GLC_ErrorLog class.
|
||||
|
||||
#include "glc_errorlog.h"
|
||||
#include <QDir>
|
||||
#include "glc_global.h"
|
||||
#include <QMutexLocker>
|
||||
|
||||
GLC_ErrorLog* GLC_ErrorLog::m_pErrorLog= NULL;
|
||||
QMutex GLC_ErrorLog::m_Mutex;
|
||||
|
||||
GLC_ErrorLog::GLC_ErrorLog(const QString& fullLogFileName)
|
||||
: GLC_Log(fullLogFileName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GLC_ErrorLog::~GLC_ErrorLog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GLC_ErrorLog* GLC_ErrorLog::instance()
|
||||
{
|
||||
if (NULL == m_pErrorLog)
|
||||
{
|
||||
QString fileName(QApplication::applicationName());
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
fileName= "GLC_lib_ErrLog";
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName= fileName + "_ErrLog";
|
||||
}
|
||||
QString logFileName(QDir::tempPath() + QDir::separator() + fileName);
|
||||
m_pErrorLog= new GLC_ErrorLog(logFileName);
|
||||
m_pErrorLog->writeHeader();
|
||||
}
|
||||
return m_pErrorLog;
|
||||
}
|
||||
|
||||
bool GLC_ErrorLog::isEmpty()
|
||||
{
|
||||
return (NULL == m_pErrorLog);
|
||||
}
|
||||
|
||||
void GLC_ErrorLog::addError(const QStringList& errorDescription)
|
||||
{
|
||||
QMutexLocker locker(&m_Mutex);
|
||||
GLC_ErrorLog::instance()->addSeparator();
|
||||
GLC_ErrorLog::instance()->addCurrentTime();
|
||||
const int size= errorDescription.size();
|
||||
for (int i= 0; i < size; ++i)
|
||||
{
|
||||
GLC_ErrorLog::instance()->add(errorDescription.at(i));
|
||||
}
|
||||
}
|
||||
void GLC_ErrorLog::close()
|
||||
{
|
||||
QMutexLocker locker(&m_Mutex);
|
||||
delete m_pErrorLog;
|
||||
m_pErrorLog= NULL;
|
||||
}
|
||||
|
||||
void GLC_ErrorLog::writeHeader()
|
||||
{
|
||||
QString currentLine;
|
||||
currentLine= "Error Log file";
|
||||
GLC_Log::m_TextStream << currentLine << '\n';
|
||||
currentLine= "Application " + QCoreApplication::applicationName();
|
||||
GLC_Log::m_TextStream << currentLine << '\n';
|
||||
currentLine= QDate::currentDate().toString(Qt::ISODate);
|
||||
GLC_Log::m_TextStream << currentLine << '\n';
|
||||
GLC_Log::m_TextStream.flush();
|
||||
}
|
97
ground/openpilotgcs/src/libs/glc_lib/glc_errorlog.h
Normal file
97
ground/openpilotgcs/src/libs/glc_lib/glc_errorlog.h
Normal file
@ -0,0 +1,97 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
//! \file glc_errorlog.h interface for the GLC_ErrorLog class.
|
||||
|
||||
#ifndef GLC_ERRORLOG_H_
|
||||
#define GLC_ERRORLOG_H_
|
||||
|
||||
#include "glc_log.h"
|
||||
#include "glc_config.h"
|
||||
#include <QStringList>
|
||||
#include <QMutex>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//! \class GLC_ErrorLog
|
||||
/*! \brief GLC_ErrorLog : handl GLC_lib error log*/
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_LIB_EXPORT GLC_ErrorLog : public GLC_Log
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! @name Constructor */
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
private:
|
||||
//! Private constructor
|
||||
GLC_ErrorLog(const QString& fullLogFileName);
|
||||
public:
|
||||
//! Destructor
|
||||
virtual ~GLC_ErrorLog();
|
||||
//@}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Get Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
//! Return the unique instance of error log file
|
||||
static GLC_ErrorLog* instance();
|
||||
|
||||
//! Return true if the log is empty
|
||||
static bool isEmpty();
|
||||
|
||||
//@}
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Set Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
//! Add error into the log
|
||||
static void addError(const QStringList& errorDescription);
|
||||
|
||||
//! Close the log file
|
||||
static void close();
|
||||
|
||||
//@}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Private services Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
//! Write error Log header
|
||||
void writeHeader();
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private members
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
private:
|
||||
//! The unique error log instance
|
||||
static GLC_ErrorLog* m_pErrorLog;
|
||||
|
||||
//! The mutex of this unique log
|
||||
static QMutex m_Mutex;
|
||||
|
||||
};
|
||||
|
||||
#endif /* GLC_ERRORLOG_H_ */
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -33,7 +31,7 @@
|
||||
GLC_Exception::GLC_Exception(const QString &message)
|
||||
: m_ErrorDescription(message)
|
||||
{
|
||||
|
||||
GLC_ErrorLog::addError(QStringList(m_ErrorDescription));
|
||||
}
|
||||
GLC_Exception::~GLC_Exception() throw()
|
||||
{
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -29,6 +27,7 @@
|
||||
|
||||
#include <exception>
|
||||
#include <QString>
|
||||
#include "glc_errorlog.h"
|
||||
|
||||
#include "glc_config.h"
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -27,6 +25,7 @@
|
||||
#include <QString>
|
||||
#include <QGLContext>
|
||||
#include <QDebug>
|
||||
#include <QGLShaderProgram>
|
||||
|
||||
#if !defined(Q_OS_MAC)
|
||||
// ARB_vertex_buffer_object
|
||||
@ -46,23 +45,6 @@ PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointerv = NULL;
|
||||
|
||||
// glMultiDrawElement
|
||||
PFNGLMULTIDRAWELEMENTSPROC glMultiDrawElements = NULL;
|
||||
// GL_ARB_shader_objects
|
||||
PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgram = NULL;
|
||||
PFNGLDELETEPROGRAMPROC glDeleteProgram = NULL;
|
||||
PFNGLUSEPROGRAMOBJECTARBPROC glUseProgram = NULL;
|
||||
PFNGLCREATESHADEROBJECTARBPROC glCreateShader = NULL;
|
||||
PFNGLDELETESHADERPROC glDeleteShader = NULL;
|
||||
PFNGLSHADERSOURCEARBPROC glShaderSource = NULL;
|
||||
PFNGLCOMPILESHADERARBPROC glCompileShader = NULL;
|
||||
PFNGLATTACHOBJECTARBPROC glAttachShader = NULL;
|
||||
PFNGLDETACHOBJECTARBPROC glDetachShader = NULL;
|
||||
PFNGLLINKPROGRAMARBPROC glLinkProgram = NULL;
|
||||
PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocation = NULL;
|
||||
PFNGLUNIFORM4FARBPROC glUniform4f = NULL;
|
||||
PFNGLUNIFORM1IARBPROC glUniform1i = NULL;
|
||||
PFNGLGETSHADERIVPROC glGetShaderiv = NULL;
|
||||
PFNGLGETPROGRAMIVARBPROC glGetProgramiv = NULL;
|
||||
PFNGLISPROGRAMARBPROC glIsProgram = NULL;
|
||||
|
||||
// GL_point_parameters Point Sprite
|
||||
PFNGLPOINTPARAMETERFARBPROC glPointParameterf = NULL;
|
||||
@ -109,47 +91,7 @@ bool glc::loadVboExtension()
|
||||
// Load GLSL extensions
|
||||
bool glc::loadGlSlExtension()
|
||||
{
|
||||
bool result= true;
|
||||
#if !defined(Q_OS_MAC)
|
||||
const QGLContext* pContext= QGLContext::currentContext();
|
||||
glCreateProgram = (PFNGLCREATEPROGRAMOBJECTARBPROC)pContext->getProcAddress(QLatin1String("glCreateProgram"));
|
||||
if (!glCreateProgram) qDebug() << "not glCreateProgram";
|
||||
glDeleteProgram = (PFNGLDELETEPROGRAMPROC)pContext->getProcAddress(QLatin1String("glDeleteProgram"));
|
||||
if (!glDeleteProgram) qDebug() << "not glDeleteProgram";
|
||||
glUseProgram = (PFNGLUSEPROGRAMOBJECTARBPROC)pContext->getProcAddress(QLatin1String("glUseProgram"));
|
||||
if (!glUseProgram) qDebug() << "not glUseProgram";
|
||||
glCreateShader = (PFNGLCREATESHADEROBJECTARBPROC)pContext->getProcAddress(QLatin1String("glCreateShader"));
|
||||
if (!glCreateShader) qDebug() << "not glCreateShader";
|
||||
glDeleteShader = (PFNGLDELETESHADERPROC)pContext->getProcAddress(QLatin1String("glDeleteShader"));
|
||||
if (!glDeleteShader) qDebug() << "not glDeleteShader";
|
||||
glShaderSource = (PFNGLSHADERSOURCEARBPROC)pContext->getProcAddress(QLatin1String("glShaderSource"));
|
||||
if (!glShaderSource) qDebug() << "not glShaderSource";
|
||||
glCompileShader = (PFNGLCOMPILESHADERARBPROC)pContext->getProcAddress(QLatin1String("glCompileShader"));
|
||||
if (!glCompileShader) qDebug() << "not glCompileShader";
|
||||
glAttachShader = (PFNGLATTACHOBJECTARBPROC)pContext->getProcAddress(QLatin1String("glAttachShader"));
|
||||
if (!glAttachShader) qDebug() << "not glAttachShader";
|
||||
glDetachShader = (PFNGLDETACHOBJECTARBPROC)pContext->getProcAddress(QLatin1String("glDetachShader"));
|
||||
if (!glDetachShader) qDebug() << "not glDetachShader";
|
||||
glLinkProgram = (PFNGLLINKPROGRAMARBPROC)pContext->getProcAddress(QLatin1String("glLinkProgram"));
|
||||
if (!glLinkProgram) qDebug() << "not glLinkProgram";
|
||||
glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONARBPROC)pContext->getProcAddress(QLatin1String("glGetUniformLocation"));
|
||||
if (!glGetUniformLocation) qDebug() << "not glGetUniformLocation";
|
||||
glUniform4f = (PFNGLUNIFORM4FARBPROC)pContext->getProcAddress(QLatin1String("glUniform4f"));
|
||||
if (!glUniform4f) qDebug() << "not glUniform4f";
|
||||
glUniform1i = (PFNGLUNIFORM1IARBPROC)pContext->getProcAddress(QLatin1String("glUniform1i"));
|
||||
if (!glUniform1i) qDebug() << "not glUniform1i";
|
||||
glGetShaderiv = (PFNGLGETSHADERIVPROC)pContext->getProcAddress(QLatin1String("glGetShaderiv"));
|
||||
if (!glGetShaderiv) qDebug() << "not glGetShaderiv";
|
||||
glGetProgramiv = (PFNGLGETPROGRAMIVARBPROC)pContext->getProcAddress(QLatin1String("glGetProgramiv"));
|
||||
if (!glGetProgramiv) qDebug() << "not glGetProgramiv";
|
||||
glIsProgram = (PFNGLISPROGRAMARBPROC)pContext->getProcAddress(QLatin1String("glIsProgram"));
|
||||
|
||||
result= glCreateProgram && glDeleteProgram && glUseProgram && glCreateShader && glDeleteShader &&
|
||||
glShaderSource && glCompileShader && glAttachShader && glDetachShader && glLinkProgram &&
|
||||
glGetUniformLocation && glUniform4f && glUniform1i && glGetShaderiv && glGetProgramiv && glIsProgram;
|
||||
|
||||
#endif
|
||||
return result;
|
||||
return QGLShaderProgram::hasOpenGLShaderPrograms();
|
||||
}
|
||||
|
||||
// Load Point Sprite extension
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -49,23 +47,6 @@ extern PFNGLGETBUFFERPOINTERVARBPROC glGetBufferPointerv;
|
||||
//extern PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements;
|
||||
// glMultiDrawElement
|
||||
extern PFNGLMULTIDRAWELEMENTSPROC glMultiDrawElements;
|
||||
// GL_ARB_shader_objects
|
||||
extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgram;
|
||||
extern PFNGLDELETEPROGRAMPROC glDeleteProgram;
|
||||
extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgram;
|
||||
extern PFNGLCREATESHADEROBJECTARBPROC glCreateShader;
|
||||
extern PFNGLDELETESHADERPROC glDeleteShader;
|
||||
extern PFNGLSHADERSOURCEARBPROC glShaderSource;
|
||||
extern PFNGLCOMPILESHADERARBPROC glCompileShader;
|
||||
extern PFNGLATTACHOBJECTARBPROC glAttachShader;
|
||||
extern PFNGLDETACHOBJECTARBPROC glDetachShader;
|
||||
extern PFNGLLINKPROGRAMARBPROC glLinkProgram;
|
||||
extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocation;
|
||||
extern PFNGLUNIFORM4FARBPROC glUniform4f;
|
||||
extern PFNGLUNIFORM1IARBPROC glUniform1i;
|
||||
extern PFNGLGETSHADERIVPROC glGetShaderiv;
|
||||
extern PFNGLGETPROGRAMIVARBPROC glGetProgramiv;
|
||||
extern PFNGLISPROGRAMARBPROC glIsProgram;
|
||||
|
||||
// GL_point_parameters Point Sprite
|
||||
extern PFNGLPOINTPARAMETERFARBPROC glPointParameterf;
|
||||
@ -86,5 +67,5 @@ namespace glc
|
||||
|
||||
//! Load Point Sprite extension
|
||||
bool loadPointSpriteExtension();
|
||||
}
|
||||
};
|
||||
#endif /*GLC_EXT_H_*/
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
Copyright (C) 2011 JŽr™me Forrissier
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -25,13 +24,9 @@
|
||||
//! \file glc_factory.cpp implementation of the GLC_Factory class.
|
||||
|
||||
#include "glc_factory.h"
|
||||
#include "io/glc_objtoworld.h"
|
||||
#include "io/glc_stltoworld.h"
|
||||
#include "io/glc_offtoworld.h"
|
||||
#include "io/glc_3dstoworld.h"
|
||||
#include "io/glc_fileloader.h"
|
||||
#include "io/glc_3dxmltoworld.h"
|
||||
#include "io/glc_colladatoworld.h"
|
||||
#include "io/glc_bsreptoworld.h"
|
||||
#include "io/glc_worldreaderplugin.h"
|
||||
|
||||
#include "viewport/glc_panmover.h"
|
||||
#include "viewport/glc_zoommover.h"
|
||||
@ -50,6 +45,8 @@
|
||||
// init static member
|
||||
GLC_Factory* GLC_Factory::m_pFactory= NULL;
|
||||
QGLContext* GLC_Factory::m_pQGLContext= NULL;
|
||||
QList<GLC_WorldReaderPlugin*> GLC_Factory::m_WorldReaderPluginList;
|
||||
QSet<QString> GLC_Factory::m_SupportedExtensionSet;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// static method
|
||||
@ -76,6 +73,7 @@ GLC_Factory* GLC_Factory::instance(const QGLContext *pContext)
|
||||
GLC_Factory::GLC_Factory(const QGLContext *pContext)
|
||||
{
|
||||
m_pQGLContext= (const_cast<QGLContext*>(pContext));
|
||||
loadPlugins();
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@ -100,6 +98,30 @@ GLC_3DRep GLC_Factory::createPoint(double x, double y, double z) const
|
||||
return newPoint;
|
||||
}
|
||||
|
||||
GLC_3DRep GLC_Factory::createPointCloud(const GLfloatVector& data, const QColor& color)
|
||||
{
|
||||
GLC_PointCloud* pPointCloud= new GLC_PointCloud();
|
||||
pPointCloud->addPoint(data);
|
||||
pPointCloud->setWireColor(color);
|
||||
return GLC_3DRep(pPointCloud);
|
||||
}
|
||||
|
||||
GLC_3DRep GLC_Factory::createPointCloud(const QList<GLC_Point3d>& pointList, const QColor& color)
|
||||
{
|
||||
GLC_PointCloud* pPointCloud= new GLC_PointCloud();
|
||||
pPointCloud->addPoint(pointList);
|
||||
pPointCloud->setWireColor(color);
|
||||
return GLC_3DRep(pPointCloud);
|
||||
}
|
||||
|
||||
GLC_3DRep GLC_Factory::createPointCloud(const QList<GLC_Point3df>& pointList, const QColor& color)
|
||||
{
|
||||
GLC_PointCloud* pPointCloud= new GLC_PointCloud();
|
||||
pPointCloud->addPoint(pointList);
|
||||
pPointCloud->setWireColor(color);
|
||||
return GLC_3DRep(pPointCloud);
|
||||
}
|
||||
|
||||
|
||||
GLC_3DRep GLC_Factory::createPointSprite(float size, GLC_Material* pMaterial) const
|
||||
{
|
||||
@ -195,80 +217,15 @@ GLC_3DViewInstance GLC_Factory::createCuttingPlane(const GLC_Point3d& point, con
|
||||
|
||||
GLC_World GLC_Factory::createWorldFromFile(QFile &file, QStringList* pAttachedFileName) const
|
||||
{
|
||||
GLC_World* pWorld= NULL;
|
||||
if (QFileInfo(file).suffix().toLower() == "obj")
|
||||
{
|
||||
GLC_ObjToWorld objToWorld(m_pQGLContext);
|
||||
connect(&objToWorld, SIGNAL(currentQuantum(int)), this, SIGNAL(currentQuantum(int)));
|
||||
pWorld= objToWorld.CreateWorldFromObj(file);
|
||||
if (NULL != pAttachedFileName)
|
||||
{
|
||||
(*pAttachedFileName)= objToWorld.listOfAttachedFileName();
|
||||
}
|
||||
}
|
||||
else if (QFileInfo(file).suffix().toLower() == "stl")
|
||||
{
|
||||
GLC_StlToWorld stlToWorld;
|
||||
connect(&stlToWorld, SIGNAL(currentQuantum(int)), this, SIGNAL(currentQuantum(int)));
|
||||
pWorld= stlToWorld.CreateWorldFromStl(file);
|
||||
}
|
||||
else if (QFileInfo(file).suffix().toLower() == "off")
|
||||
{
|
||||
GLC_OffToWorld offToWorld;
|
||||
connect(&offToWorld, SIGNAL(currentQuantum(int)), this, SIGNAL(currentQuantum(int)));
|
||||
pWorld= offToWorld.CreateWorldFromOff(file);
|
||||
}
|
||||
else if (QFileInfo(file).suffix().toLower() == "3ds")
|
||||
{
|
||||
GLC_3dsToWorld studioToWorld(m_pQGLContext);
|
||||
connect(&studioToWorld, SIGNAL(currentQuantum(int)), this, SIGNAL(currentQuantum(int)));
|
||||
pWorld= studioToWorld.CreateWorldFrom3ds(file);
|
||||
if (NULL != pAttachedFileName)
|
||||
{
|
||||
(*pAttachedFileName)= studioToWorld.listOfAttachedFileName();
|
||||
}
|
||||
}
|
||||
else if (QFileInfo(file).suffix().toLower() == "3dxml")
|
||||
{
|
||||
GLC_3dxmlToWorld d3dxmlToWorld(m_pQGLContext);
|
||||
connect(&d3dxmlToWorld, SIGNAL(currentQuantum(int)), this, SIGNAL(currentQuantum(int)));
|
||||
pWorld= d3dxmlToWorld.createWorldFrom3dxml(file, false);
|
||||
if (NULL != pAttachedFileName)
|
||||
{
|
||||
(*pAttachedFileName)= d3dxmlToWorld.listOfAttachedFileName();
|
||||
}
|
||||
}
|
||||
else if (QFileInfo(file).suffix().toLower() == "dae")
|
||||
{
|
||||
GLC_ColladaToWorld colladaToWorld(m_pQGLContext);
|
||||
connect(&colladaToWorld, SIGNAL(currentQuantum(int)), this, SIGNAL(currentQuantum(int)));
|
||||
pWorld= colladaToWorld.CreateWorldFromCollada(file);
|
||||
if (NULL != pAttachedFileName)
|
||||
{
|
||||
(*pAttachedFileName)= colladaToWorld.listOfAttachedFileName();
|
||||
}
|
||||
}
|
||||
else if (QFileInfo(file).suffix().toLower() == "bsrep")
|
||||
{
|
||||
GLC_BSRepToWorld bsRepToWorld;
|
||||
pWorld= bsRepToWorld.CreateWorldFromBSRep(file);
|
||||
emit currentQuantum(100);
|
||||
}
|
||||
GLC_FileLoader* pLoader = createFileLoader();
|
||||
connect(pLoader, SIGNAL(currentQuantum(int)), this, SIGNAL(currentQuantum(int)));
|
||||
GLC_World world = pLoader->createWorldFromFile(file, pAttachedFileName);
|
||||
delete pLoader;
|
||||
|
||||
if (NULL == pWorld)
|
||||
{
|
||||
// File extension not recognize or file not loaded
|
||||
QString message(QString("GLC_Factory::createWorldFromFile File ") + file.fileName() + QString(" not loaded"));
|
||||
GLC_FileFormatException fileFormatException(message, file.fileName(), GLC_FileFormatException::FileNotSupported);
|
||||
throw(fileFormatException);
|
||||
}
|
||||
GLC_World resulWorld(*pWorld);
|
||||
delete pWorld;
|
||||
|
||||
return resulWorld;
|
||||
return world;
|
||||
}
|
||||
|
||||
GLC_World GLC_Factory::createWorldStructureFrom3dxml(QFile &file) const
|
||||
GLC_World GLC_Factory::createWorldStructureFrom3dxml(QFile &file, bool GetExtRefName) const
|
||||
{
|
||||
GLC_World* pWorld= NULL;
|
||||
|
||||
@ -276,7 +233,7 @@ GLC_World GLC_Factory::createWorldStructureFrom3dxml(QFile &file) const
|
||||
{
|
||||
GLC_3dxmlToWorld d3dxmlToWorld(m_pQGLContext);
|
||||
connect(&d3dxmlToWorld, SIGNAL(currentQuantum(int)), this, SIGNAL(currentQuantum(int)));
|
||||
pWorld= d3dxmlToWorld.createWorldFrom3dxml(file, true);
|
||||
pWorld= d3dxmlToWorld.createWorldFrom3dxml(file, true, GetExtRefName);
|
||||
}
|
||||
|
||||
if (NULL == pWorld)
|
||||
@ -307,6 +264,11 @@ GLC_3DRep GLC_Factory::create3DRepFromFile(const QString& fileName) const
|
||||
|
||||
}
|
||||
|
||||
GLC_FileLoader* GLC_Factory::createFileLoader() const
|
||||
{
|
||||
return new GLC_FileLoader(m_pQGLContext);
|
||||
}
|
||||
|
||||
GLC_Material* GLC_Factory::createMaterial() const
|
||||
{
|
||||
return new GLC_Material();
|
||||
@ -423,3 +385,70 @@ GLC_MoverController GLC_Factory::createDefaultMoverController(const QColor& colo
|
||||
|
||||
return defaultController;
|
||||
}
|
||||
|
||||
|
||||
void GLC_Factory::loadPlugins()
|
||||
{
|
||||
Q_ASSERT(NULL != QCoreApplication::instance());
|
||||
const QStringList libraryPath= QCoreApplication::libraryPaths();
|
||||
foreach(QString path, libraryPath)
|
||||
{
|
||||
const QDir pluginsDir= QDir(path);
|
||||
const QStringList pluginNames= pluginsDir.entryList(QDir::Files);
|
||||
foreach (QString fileName, pluginNames)
|
||||
{
|
||||
QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
|
||||
QObject* pPlugin= loader.instance();
|
||||
GLC_WorldReaderPlugin* pWorldReader = qobject_cast<GLC_WorldReaderPlugin *>(pPlugin);
|
||||
if (pWorldReader)
|
||||
{
|
||||
m_WorldReaderPluginList.append(pWorldReader);
|
||||
m_SupportedExtensionSet.unite(QSet<QString>::fromList(pWorldReader->keys()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//qDebug() << m_WorldReaderPluginList.size() << " Loaded plugins.";
|
||||
}
|
||||
|
||||
QList<GLC_WorldReaderPlugin*> GLC_Factory::worldReaderPlugins()
|
||||
{
|
||||
if (NULL == m_pFactory)
|
||||
{
|
||||
instance();
|
||||
}
|
||||
return m_WorldReaderPluginList;
|
||||
}
|
||||
|
||||
bool GLC_Factory::canBeLoaded(const QString& extension)
|
||||
{
|
||||
if (NULL == m_pFactory)
|
||||
{
|
||||
instance();
|
||||
}
|
||||
|
||||
return m_SupportedExtensionSet.contains(extension.toLower());
|
||||
}
|
||||
|
||||
GLC_WorldReaderHandler* GLC_Factory::loadingHandler(const QString& fileName)
|
||||
{
|
||||
if (NULL == m_pFactory)
|
||||
{
|
||||
instance();
|
||||
}
|
||||
|
||||
const QString extension= QFileInfo(fileName).suffix();
|
||||
if (canBeLoaded(extension))
|
||||
{
|
||||
foreach(GLC_WorldReaderPlugin* pPlugin, m_WorldReaderPluginList)
|
||||
{
|
||||
if (pPlugin->keys().contains(extension.toLower()))
|
||||
{
|
||||
return pPlugin->readerHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
Copyright (C) 2011 JŽr™me Forrissier
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -30,6 +29,7 @@
|
||||
#include <QObject>
|
||||
#include <QtOpenGL>
|
||||
#include <QString>
|
||||
#include <QSet>
|
||||
|
||||
//class to built
|
||||
#include "geometry/glc_point.h"
|
||||
@ -42,6 +42,7 @@
|
||||
#include "geometry/glc_sphere.h"
|
||||
#include "geometry/glc_rectangle.h"
|
||||
#include "geometry/glc_3drep.h"
|
||||
#include "geometry/glc_pointcloud.h"
|
||||
#include "shading/glc_material.h"
|
||||
#include "shading/glc_texture.h"
|
||||
#include "sceneGraph/glc_world.h"
|
||||
@ -49,9 +50,13 @@
|
||||
#include "glc_boundingbox.h"
|
||||
#include "viewport/glc_movercontroller.h"
|
||||
#include "viewport/glc_viewport.h"
|
||||
#include "io/glc_fileloader.h"
|
||||
|
||||
// end of class to built
|
||||
|
||||
class GLC_WorldReaderHandler;
|
||||
class GLC_WorldReaderPlugin;
|
||||
|
||||
#include "glc_config.h"
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//! \class GLC_Factory
|
||||
@ -88,6 +93,13 @@ public:
|
||||
|
||||
GLC_3DRep createPoint(double x, double y, double z) const;
|
||||
|
||||
//! Create a cloud of points
|
||||
GLC_3DRep createPointCloud(const GLfloatVector& data, const QColor& color);
|
||||
|
||||
GLC_3DRep createPointCloud(const QList<GLC_Point3d>& pointList, const QColor& color);
|
||||
|
||||
GLC_3DRep createPointCloud(const QList<GLC_Point3df>& pointList, const QColor& color);
|
||||
|
||||
//! Create a GLC_PointSprite
|
||||
GLC_3DRep createPointSprite(float, GLC_Material*) const;
|
||||
|
||||
@ -124,11 +136,14 @@ public:
|
||||
GLC_World createWorldFromFile(QFile &file, QStringList* pAttachedFileName= NULL) const;
|
||||
|
||||
//! Create a GLC_World containing only the 3dxml structure
|
||||
GLC_World createWorldStructureFrom3dxml(QFile &file) const;
|
||||
GLC_World createWorldStructureFrom3dxml(QFile &file, bool GetExtRefName= false) const;
|
||||
|
||||
//! Create 3DRep from 3dxml or 3DRep file
|
||||
GLC_3DRep create3DRepFromFile(const QString&) const;
|
||||
|
||||
//! Create a GLC_FileLoader
|
||||
GLC_FileLoader* createFileLoader() const;
|
||||
|
||||
//! Create default material
|
||||
GLC_Material* createMaterial() const;
|
||||
|
||||
@ -156,12 +171,28 @@ public:
|
||||
//! Create the default mover controller
|
||||
GLC_MoverController createDefaultMoverController(const QColor&, GLC_Viewport*);
|
||||
|
||||
//! Return the list of world reader plugin
|
||||
static QList<GLC_WorldReaderPlugin*> worldReaderPlugins();
|
||||
|
||||
//! Return true if the given file extension can be loaded
|
||||
static bool canBeLoaded(const QString& extension);
|
||||
|
||||
//! Return an handle to the plugin tu use for the given file
|
||||
static GLC_WorldReaderHandler* loadingHandler(const QString& fileName);
|
||||
|
||||
//@}
|
||||
|
||||
signals:
|
||||
//! For progress bar management
|
||||
void currentQuantum(int) const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private services functions
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
private:
|
||||
//! Load GLC_lib plugins
|
||||
void loadPlugins();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private members
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@ -173,6 +204,12 @@ private:
|
||||
//! The QGLContext attached to the factory (rendering context)
|
||||
static QGLContext* m_pQGLContext;
|
||||
|
||||
//! The list off worldReader plugins
|
||||
static QList<GLC_WorldReaderPlugin*> m_WorldReaderPluginList;
|
||||
|
||||
//! The supported extension set
|
||||
static QSet<QString> m_SupportedExtensionSet;
|
||||
|
||||
};
|
||||
|
||||
#endif /*GLC_FACTORY_*/
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -31,6 +29,7 @@ GLC_FileFormatException::GLC_FileFormatException(const QString &message, const Q
|
||||
, m_FileName(fileName)
|
||||
, m_ExceptionType(exceptionType)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GLC_FileFormatException::~GLC_FileFormatException() throw()
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -30,6 +28,7 @@ QMutex glc::iDMutex;
|
||||
QMutex glc::geomIdMutex;
|
||||
QMutex glc::userIdMutex;
|
||||
QMutex glc::widget3dIdMutex;
|
||||
QMutex glc::shadingGroupIdMutex;
|
||||
|
||||
GLC_uint glc::GLC_GenID(void)
|
||||
{
|
||||
@ -67,6 +66,15 @@ GLC_uint glc::GLC_Gen3DWidgetID(void)
|
||||
return Id;
|
||||
}
|
||||
|
||||
GLC_uint glc::GLC_GenShaderGroupID()
|
||||
{
|
||||
static GLC_uint Id= 1;
|
||||
glc::shadingGroupIdMutex.lock();
|
||||
Id++;
|
||||
glc::shadingGroupIdMutex.unlock();
|
||||
return Id;
|
||||
}
|
||||
|
||||
const QString glc::archivePrefix()
|
||||
{
|
||||
return "glc_Zip::";
|
||||
@ -77,6 +85,16 @@ const QString glc::archiveInfix()
|
||||
return "::glc_Zip::";
|
||||
}
|
||||
|
||||
const QString glc::filePrefix()
|
||||
{
|
||||
return "File::";
|
||||
}
|
||||
|
||||
const QString glc::fileInfix()
|
||||
{
|
||||
return "::File::";
|
||||
}
|
||||
|
||||
bool glc::isArchiveString(const QString& fileName)
|
||||
{
|
||||
bool inArchive= fileName.startsWith(archivePrefix());
|
||||
@ -84,25 +102,65 @@ bool glc::isArchiveString(const QString& fileName)
|
||||
return inArchive;
|
||||
}
|
||||
|
||||
bool glc::isFileString(const QString& fileName)
|
||||
{
|
||||
bool inFile= fileName.startsWith(filePrefix());
|
||||
inFile= inFile && fileName.contains(fileInfix());
|
||||
return inFile;
|
||||
}
|
||||
|
||||
QString glc::builtArchiveString(const QString& Archive, const QString& entry)
|
||||
{
|
||||
return QString(archivePrefix() + Archive + archiveInfix() + entry);
|
||||
}
|
||||
|
||||
QString glc::builtFileString(const QString& File, const QString& entry)
|
||||
{
|
||||
const QString repFileName= QFileInfo(File).absolutePath() + QDir::separator() + entry;
|
||||
return QString(filePrefix() + File + fileInfix() + repFileName);
|
||||
}
|
||||
|
||||
QString glc::archiveFileName(const QString& archiveString)
|
||||
{
|
||||
Q_ASSERT(isArchiveString(archiveString));
|
||||
const int indexOfInfix= archiveString.indexOf(archiveInfix());
|
||||
const int prefixLength= archivePrefix().length();
|
||||
const bool isArchiveEncoded= isArchiveString(archiveString);
|
||||
const bool isFileEncoded= isFileString(archiveString);
|
||||
|
||||
Q_ASSERT(isArchiveEncoded || isFileEncoded);
|
||||
QString infix;
|
||||
QString prefix;
|
||||
if (isArchiveEncoded)
|
||||
{
|
||||
infix= archiveInfix();
|
||||
prefix= archivePrefix();
|
||||
}
|
||||
else if (isFileEncoded)
|
||||
{
|
||||
infix= fileInfix();
|
||||
prefix= filePrefix();
|
||||
}
|
||||
const int indexOfInfix= archiveString.indexOf(infix);
|
||||
const int prefixLength= prefix.length();
|
||||
const int length= indexOfInfix - prefixLength;
|
||||
return archiveString.mid(prefixLength, length);
|
||||
}
|
||||
|
||||
QString glc::archiveEntryFileName(const QString& archiveString)
|
||||
{
|
||||
Q_ASSERT(isArchiveString(archiveString));
|
||||
const int indexOfInfix= archiveString.indexOf(archiveInfix());
|
||||
const int infixLength= archiveInfix().length();
|
||||
const bool isArchiveEncoded= isArchiveString(archiveString);
|
||||
const bool isFileEncoded= isFileString(archiveString);
|
||||
|
||||
Q_ASSERT(isArchiveEncoded || isFileEncoded);
|
||||
QString infix;
|
||||
if (isArchiveEncoded)
|
||||
{
|
||||
infix= archiveInfix();
|
||||
}
|
||||
else if (isFileEncoded)
|
||||
{
|
||||
infix= fileInfix();
|
||||
}
|
||||
const int indexOfInfix= archiveString.indexOf(infix);
|
||||
const int infixLength= infix.length();
|
||||
const int length= archiveString.length() - (indexOfInfix + infixLength);
|
||||
return archiveString.right(length);
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
@ -54,16 +52,19 @@ typedef QVector<GLuint> OffsetVectori;
|
||||
namespace glc
|
||||
{
|
||||
//! Simple ID generation
|
||||
GLC_LIB_EXPORT GLC_uint GLC_GenID(void);
|
||||
GLC_LIB_EXPORT GLC_uint GLC_GenID();
|
||||
|
||||
//! Simple Geom ID generation
|
||||
GLC_LIB_EXPORT GLC_uint GLC_GenGeomID(void);
|
||||
GLC_LIB_EXPORT GLC_uint GLC_GenGeomID();
|
||||
|
||||
//! Simple User ID generation
|
||||
GLC_LIB_EXPORT GLC_uint GLC_GenUserID(void);
|
||||
GLC_LIB_EXPORT GLC_uint GLC_GenUserID();
|
||||
|
||||
//! Simple 3D widget ID generation
|
||||
GLC_LIB_EXPORT GLC_uint GLC_Gen3DWidgetID(void);
|
||||
GLC_LIB_EXPORT GLC_uint GLC_Gen3DWidgetID();
|
||||
|
||||
//! Simple shading group generation
|
||||
GLC_LIB_EXPORT GLC_uint GLC_GenShaderGroupID();
|
||||
|
||||
//! Return the GLC_uint decoded ID from RGB encoded ID
|
||||
inline GLC_uint decodeRgbId(const GLubyte*);
|
||||
@ -78,6 +79,7 @@ namespace glc
|
||||
extern QMutex geomIdMutex;
|
||||
extern QMutex userIdMutex;
|
||||
extern QMutex widget3dIdMutex;
|
||||
extern QMutex shadingGroupIdMutex;
|
||||
|
||||
//! 3D widget event flag
|
||||
enum WidgetEventFlag
|
||||
@ -93,19 +95,35 @@ namespace glc
|
||||
//! Return GLC_lib Archive infix string
|
||||
GLC_LIB_EXPORT const QString archiveInfix();
|
||||
|
||||
//! Return GLC_lib File prefix string
|
||||
GLC_LIB_EXPORT const QString filePrefix();
|
||||
|
||||
//! Return GLC_lib File infix string
|
||||
GLC_LIB_EXPORT const QString fileInfix();
|
||||
|
||||
//! Return true if the given file name is in a archive string
|
||||
GLC_LIB_EXPORT bool isArchiveString(const QString& fileName);
|
||||
|
||||
//! Return true if the given file name is in a File string
|
||||
GLC_LIB_EXPORT bool isFileString(const QString& fileName);
|
||||
|
||||
//! Return archive string form the given archive fileName and fileName entry
|
||||
GLC_LIB_EXPORT QString builtArchiveString(const QString& Archive, const QString& entry);
|
||||
|
||||
//! Return archive string form the given archive fileName and fileName entry
|
||||
GLC_LIB_EXPORT QString builtFileString(const QString& File, const QString& entry);
|
||||
|
||||
//! Return Archive filename from the given archive string
|
||||
GLC_LIB_EXPORT QString archiveFileName(const QString& archiveString);
|
||||
|
||||
//! Return Archive entry filname from the given archive string
|
||||
GLC_LIB_EXPORT QString archiveEntryFileName(const QString& archiveString);
|
||||
|
||||
}
|
||||
// GLC_Lib version
|
||||
const QString version("2.1.0");
|
||||
const QString description("GLC_lib is a Open Source C++ class library that enables the quick creation of an OpenGL application based on QT4.");
|
||||
|
||||
};
|
||||
|
||||
// Return the GLC_uint decoded ID from RGBA encoded ID
|
||||
GLC_uint glc::decodeRgbId(const GLubyte* pcolorId)
|
||||
@ -129,11 +147,6 @@ void glc::encodeRgbId(GLC_uint id, GLubyte* colorId)
|
||||
colorId[3]= static_cast<GLubyte>((id >> (3 * 8)) & 0xFF);
|
||||
}
|
||||
|
||||
// GLC_Lib version
|
||||
|
||||
#define GLC_VERSION "2.0.0"
|
||||
#define GLC_DESCRIPTION "GLC_lib is a Open Source C++ class library that enables the quick creation of an OpenGL application based on QT4."
|
||||
|
||||
|
||||
#endif //GLC_GLOBAL_H_
|
||||
|
||||
|
@ -4,7 +4,7 @@ DEFINES += GLC_LIB_LIBRARY
|
||||
include(../../openpilotgcslibrary.pri)
|
||||
|
||||
# GLC_lib qmake configuration
|
||||
TEMPLATE = lib
|
||||
#TEMPLATE = lib
|
||||
QT += opengl \
|
||||
core
|
||||
|
||||
@ -13,7 +13,7 @@ QT += opengl \
|
||||
# release \
|
||||
# warn_on
|
||||
#TARGET = GLC_lib
|
||||
#VERSION = 2.0.0
|
||||
#VERSION = 2.1.0
|
||||
|
||||
DEFINES += CREATE_GLC_LIB_DLL
|
||||
DEFINES += LIB3DS_EXPORTS
|
||||
@ -81,7 +81,11 @@ HEADERS_GLC_IO += io/glc_objmtlloader.h \
|
||||
io/glc_3dxmltoworld.h \
|
||||
io/glc_colladatoworld.h \
|
||||
io/glc_worldto3dxml.h \
|
||||
io/glc_bsreptoworld.h
|
||||
io/glc_bsreptoworld.h \
|
||||
io/glc_xmlutil.h \
|
||||
io/glc_fileloader.h \
|
||||
io/glc_worldreaderplugin.h \
|
||||
io/glc_worldreaderhandler.h
|
||||
|
||||
HEADERS_GLC_SCENEGRAPH += sceneGraph/glc_3dviewcollection.h \
|
||||
sceneGraph/glc_3dviewinstance.h \
|
||||
@ -93,7 +97,8 @@ HEADERS_GLC_SCENEGRAPH += sceneGraph/glc_3dviewcollection.h \
|
||||
sceneGraph/glc_worldhandle.h \
|
||||
sceneGraph/glc_spacepartitioning.h \
|
||||
sceneGraph/glc_octree.h \
|
||||
sceneGraph/glc_octreenode.h
|
||||
sceneGraph/glc_octreenode.h \
|
||||
sceneGraph/glc_selectionset.h
|
||||
|
||||
HEADERS_GLC_GEOMETRY += geometry/glc_geometry.h \
|
||||
geometry/glc_circle.h \
|
||||
@ -115,7 +120,8 @@ HEADERS_GLC_GEOMETRY += geometry/glc_geometry.h \
|
||||
geometry/glc_polylines.h \
|
||||
geometry/glc_disc.h \
|
||||
geometry/glc_cone.h \
|
||||
geometry/glc_sphere.h
|
||||
geometry/glc_sphere.h \
|
||||
geometry/glc_pointcloud.h
|
||||
|
||||
HEADERS_GLC_SHADING += shading/glc_material.h \
|
||||
shading/glc_texture.h \
|
||||
@ -153,7 +159,11 @@ HEADERS_GLC += glc_global.h \
|
||||
glc_state.h \
|
||||
glc_config.h \
|
||||
glc_cachemanager.h \
|
||||
glc_renderstatistics.h
|
||||
glc_renderstatistics.h \
|
||||
glc_log.h \
|
||||
glc_errorlog.h \
|
||||
glc_tracelog.h \
|
||||
glc_openglstate.h
|
||||
|
||||
HEADERS_GLC_3DWIDGET += 3DWidget/glc_3dwidget.h \
|
||||
3DWidget/glc_cuttingplane.h \
|
||||
@ -222,7 +232,8 @@ SOURCES += io/glc_objmtlloader.cpp \
|
||||
io/glc_3dxmltoworld.cpp \
|
||||
io/glc_colladatoworld.cpp \
|
||||
io/glc_worldto3dxml.cpp \
|
||||
io/glc_bsreptoworld.cpp
|
||||
io/glc_bsreptoworld.cpp \
|
||||
io/glc_fileloader.cpp
|
||||
|
||||
SOURCES += sceneGraph/glc_3dviewcollection.cpp \
|
||||
sceneGraph/glc_3dviewinstance.cpp \
|
||||
@ -234,7 +245,8 @@ SOURCES += sceneGraph/glc_3dviewcollection.cpp \
|
||||
sceneGraph/glc_worldhandle.cpp \
|
||||
sceneGraph/glc_spacepartitioning.cpp \
|
||||
sceneGraph/glc_octree.cpp \
|
||||
sceneGraph/glc_octreenode.cpp
|
||||
sceneGraph/glc_octreenode.cpp \
|
||||
sceneGraph/glc_selectionset.cpp
|
||||
|
||||
SOURCES += geometry/glc_geometry.cpp \
|
||||
geometry/glc_circle.cpp \
|
||||
@ -256,7 +268,8 @@ SOURCES += geometry/glc_geometry.cpp \
|
||||
geometry/glc_polylines.cpp \
|
||||
geometry/glc_disc.cpp \
|
||||
geometry/glc_cone.cpp \
|
||||
geometry/glc_sphere.cpp
|
||||
geometry/glc_sphere.cpp \
|
||||
geometry/glc_pointcloud.cpp
|
||||
|
||||
|
||||
SOURCES += shading/glc_material.cpp \
|
||||
@ -293,7 +306,11 @@ SOURCES += glc_global.cpp \
|
||||
glc_ext.cpp \
|
||||
glc_state.cpp \
|
||||
glc_cachemanager.cpp \
|
||||
glc_renderstatistics.cpp
|
||||
glc_renderstatistics.cpp \
|
||||
glc_log.cpp \
|
||||
glc_errorlog.cpp \
|
||||
glc_tracelog.cpp \
|
||||
glc_openglstate.cpp
|
||||
|
||||
SOURCES += 3DWidget/glc_3dwidget.cpp \
|
||||
3DWidget/glc_cuttingplane.cpp \
|
||||
@ -353,7 +370,7 @@ HEADERS_INST = include/GLC_BoundingBox \
|
||||
include/GLC_RepCrossMover \
|
||||
include/GLC_RepTrackBallMover \
|
||||
include/GLC_TurnTableMover \
|
||||
include/GLC_Attribute \
|
||||
include/GLC_Attributes \
|
||||
include/GLC_Rectangle \
|
||||
include/GLC_Mesh \
|
||||
include/GLC_StructOccurence \
|
||||
@ -391,14 +408,24 @@ HEADERS_INST = include/GLC_BoundingBox \
|
||||
include/GLC_Ext \
|
||||
include/GLC_Cone \
|
||||
include/GLC_Sphere \
|
||||
include/GLC_Axis
|
||||
|
||||
include/GLC_Axis \
|
||||
include/GLC_Log \
|
||||
include/GLC_ErrorLog \
|
||||
include/GLC_TraceLog \
|
||||
include/glcXmlUtil \
|
||||
include/GLC_OpenGLState \
|
||||
include/GLC_FileLoader \
|
||||
include/GLC_WorldReaderPlugin \
|
||||
include/GLC_WorldReaderHandler \
|
||||
include/GLC_PointCloud \
|
||||
include/GLC_SelectionSet
|
||||
|
||||
|
||||
# Linux and macx install configuration
|
||||
unix {
|
||||
# Location of HEADERS and library
|
||||
LIB_DIR = ./install/lib
|
||||
INCLUDE_DIR = ./install/include
|
||||
LIB_DIR = /usr/local/lib
|
||||
INCLUDE_DIR = /usr/local/include
|
||||
# Adds a -P to preserve link
|
||||
QMAKE_COPY_FILE = $${QMAKE_COPY_FILE} -P
|
||||
include.path = $${INCLUDE_DIR}/GLC_lib
|
||||
@ -448,10 +475,10 @@ include_glc_3dwidget.files = $${HEADERS_GLC_3DWIDGET}
|
||||
target.path = $${LIB_DIR}
|
||||
|
||||
# "make install" configuration options
|
||||
#INSTALLS += include_lib3ds include_glext include_quazip include_glc_maths include_glc_io
|
||||
#INSTALLS += include_glc_scengraph include_glc_geometry include_glc_shading include_glc_viewport
|
||||
#INSTALLS += include_glc_3dwidget
|
||||
INSTALLS += include_lib3ds include_glext include_quazip include_glc_maths include_glc_io
|
||||
INSTALLS += include_glc_scengraph include_glc_geometry include_glc_shading include_glc_viewport
|
||||
INSTALLS += include_glc_3dwidget
|
||||
|
||||
#INSTALLS += target
|
||||
#INSTALLS +=include
|
||||
INSTALLS += target
|
||||
INSTALLS +=include
|
||||
|
||||
|
73
ground/openpilotgcs/src/libs/glc_lib/glc_log.cpp
Normal file
73
ground/openpilotgcs/src/libs/glc_lib/glc_log.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
//! \file glc_log.h implementation of the GLC_Log class.
|
||||
|
||||
#include "glc_log.h"
|
||||
#include <QtDebug>
|
||||
#include <QTime>
|
||||
|
||||
GLC_Log::GLC_Log(const QString& baseLogFileName)
|
||||
: m_pFile(new QTemporaryFile(baseLogFileName))
|
||||
, m_TextStream()
|
||||
{
|
||||
Q_CHECK_PTR(m_pFile);
|
||||
m_pFile->open();
|
||||
m_pFile->setAutoRemove(false);
|
||||
m_TextStream.setDevice(m_pFile);
|
||||
}
|
||||
|
||||
GLC_Log::~GLC_Log()
|
||||
{
|
||||
m_TextStream.flush();
|
||||
delete m_pFile;
|
||||
}
|
||||
|
||||
QString GLC_Log::fullFileName() const
|
||||
{
|
||||
Q_ASSERT(NULL != m_pFile);
|
||||
return m_pFile->fileName();
|
||||
}
|
||||
|
||||
void GLC_Log::add(const QString& line)
|
||||
{
|
||||
Q_ASSERT(NULL != m_pFile);
|
||||
qWarning() << line;
|
||||
m_TextStream << line << '\n';
|
||||
m_TextStream.flush();
|
||||
}
|
||||
|
||||
void GLC_Log::addSeparator()
|
||||
{
|
||||
Q_ASSERT(NULL != m_pFile);
|
||||
const QString separator("---------------------------------------------------------------------");
|
||||
qWarning() << separator;
|
||||
m_TextStream << separator << '\n';
|
||||
m_TextStream.flush();
|
||||
}
|
||||
|
||||
void GLC_Log::addCurrentTime()
|
||||
{
|
||||
Q_ASSERT(NULL != m_pFile);
|
||||
m_TextStream << QTime::currentTime().toString() << '\n';
|
||||
m_TextStream.flush();
|
||||
}
|
95
ground/openpilotgcs/src/libs/glc_lib/glc_log.h
Normal file
95
ground/openpilotgcs/src/libs/glc_lib/glc_log.h
Normal file
@ -0,0 +1,95 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
//! \file glc_log.h interface for the GLC_Log class.
|
||||
|
||||
#ifndef GLC_LOG_H_
|
||||
#define GLC_LOG_H_
|
||||
|
||||
#include <QString>
|
||||
#include <QTemporaryFile>
|
||||
#include <QTextStream>
|
||||
#include "glc_config.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//! \class GLC_Log
|
||||
/*! \brief GLC_Log : Base class for GLC_lib log*/
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_LIB_EXPORT GLC_Log
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! @name Constructor */
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
protected:
|
||||
//! Construct a log of the given base fileName
|
||||
GLC_Log(const QString& baseLogFileName);
|
||||
public:
|
||||
//! Destructor
|
||||
virtual ~GLC_Log();
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Get Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
//! Return this log full file name
|
||||
QString fullFileName() const;
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Set Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
protected:
|
||||
//! Add the given string to this log
|
||||
void add(const QString& line);
|
||||
|
||||
//! Add blank line to this log
|
||||
inline void addBlankLine()
|
||||
{add(QString());}
|
||||
|
||||
//! Add a separator in the log
|
||||
void addSeparator();
|
||||
|
||||
//! Add current time in log
|
||||
void addCurrentTime();
|
||||
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private members
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
protected:
|
||||
|
||||
//! This log file
|
||||
QTemporaryFile* m_pFile;
|
||||
|
||||
//! This log textStream
|
||||
QTextStream m_TextStream;
|
||||
|
||||
};
|
||||
|
||||
#endif /* GLC_LOG_H_ */
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
Version 2.0.0, packaged on July 2010.
|
||||
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
|
34
ground/openpilotgcs/src/libs/glc_lib/glc_openglstate.cpp
Normal file
34
ground/openpilotgcs/src/libs/glc_lib/glc_openglstate.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
//! \file glc_openglstate.cpp implementation of the GLC_OpenGLState class.
|
||||
|
||||
#include "glc_openglstate.h"
|
||||
|
||||
GLC_OpenGLState::GLC_OpenGLState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GLC_OpenGLState::~GLC_OpenGLState()
|
||||
{
|
||||
|
||||
}
|
68
ground/openpilotgcs/src/libs/glc_lib/glc_openglstate.h
Normal file
68
ground/openpilotgcs/src/libs/glc_lib/glc_openglstate.h
Normal file
@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
//! \file glc_openglstate.h interface for the GLC_OpenGLState class.
|
||||
|
||||
#ifndef GLC_OPENGLSTATE_H_
|
||||
#define GLC_OPENGLSTATE_H_
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//! \class GLC_OpenGLState
|
||||
/*! \brief GLC_OpenGLState is use to store and retrieve differential opengl state*/
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
class GLC_OpenGLState
|
||||
{
|
||||
public:
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! @name Constructor / Destructor */
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
GLC_OpenGLState();
|
||||
virtual ~GLC_OpenGLState();
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Get Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
/*! \name Set Functions*/
|
||||
//@{
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
//!
|
||||
|
||||
//@}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Private members
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif /* GLC_OPENGLSTATE_H_ */
|
@ -0,0 +1,34 @@
|
||||
/****************************************************************************
|
||||
|
||||
This file is part of the GLC-lib library.
|
||||
Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
|
||||
http://glc-lib.sourceforge.net
|
||||
|
||||
GLC-lib is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GLC-lib is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with GLC-lib; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*****************************************************************************/
|
||||
//! \file glc_openglstatemanager.cpp implementation of the GLC_OpenGLStateManager class.
|
||||
|
||||
#include "glc_openglstatemanager.h"
|
||||
|
||||
GLC_OpenGLStateManager::GLC_OpenGLStateManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GLC_OpenGLStateManager::~GLC_OpenGLStateManager()
|
||||
{
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user