Select Git revision
_mhandle_helper.py
vertex_array.cc 42.61 KiB
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2010 by the OpenStructure authors
//
// This library 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.0 of the License, or (at your option)
// any later version.
// This library 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 this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//------------------------------------------------------------------------------
/*
Author: Ansgar Philippsen
*/
#include <boost/format.hpp>
#include "vertex_array.hh"
#include "glext_include.hh"
#include "color.hh"
#include "material.hh"
#include "scene.hh"
#include "vertex_array_helper.hh"
#include "povray.hh"
#include "impl/calc_ambient.hh"
#if OST_SHADER_SUPPORT_ENABLED
#include "shader.hh"
#endif
#define VERTEX_ARRAY_CHECK_GL_ERROR(m) \
if((glerr=glGetError())!=0) { \
LOGN_VERBOSE("Error during va buffer prep: " << m << " : " << gluErrorString(glerr)); \
return false; \
}
namespace ost {
using namespace geom;
namespace gfx {
// the header and this file contain several magic number 7 uses related to the max buffer
static const int VA_VERTEX_BUFFER=0;
static const int VA_LINEINDEX_BUFFER=1;
static const int VA_TRIINDEX_BUFFER=2;
static const int VA_QUADINDEX_BUFFER=3;
static const int VA_AMBIENT_BUFFER=4;
static const int VA_NORMAL_BUFFER=5;
static const int VA_COLOR_BUFFER=6;
IndexedVertexArray::Entry::Entry()
{
v[0]=0.0; v[1]=0.0; v[2]=0.0;
n[0]=0.0; n[1]=0.0; n[2]=1.0;
c[0]=0.0; c[1]=0.0; c[2]=0.0; c[3]=0.0;
}
IndexedVertexArray::Entry::Entry(const Vec3& vv, const Vec3& nn, const Color& cc)
{