diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-06 17:17:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-06 17:17:34 +0000 |
commit | 7f9f7dad00ea5f025578c491005835740f9ffd90 (patch) | |
tree | 011a87a78042a82ea3a18f5c08e60f6a3930bf0b /Build/source/utils/asymptote/material.h | |
parent | 37d8fb68e502daabe6aa5f5ae9fb78191f275742 (diff) |
asy 2.56 sources
git-svn-id: svn://tug.org/texlive/trunk@52300 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/material.h')
-rw-r--r-- | Build/source/utils/asymptote/material.h | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/Build/source/utils/asymptote/material.h b/Build/source/utils/asymptote/material.h index 4a07229046c..d6a6084ae57 100644 --- a/Build/source/utils/asymptote/material.h +++ b/Build/source/utils/asymptote/material.h @@ -1,6 +1,13 @@ -#ifndef MATERIAL_STRUCT -#define MATERIAL_STRUCT -#ifdef HAVE_GL +#ifndef MATERIAL_H +#define MATERIAL_H + +#ifdef HAVE_LIBGLM + +#include <iostream> +#include <fstream> + +#include "common.h" +#include "triple.h" #include <glm/glm.hpp> @@ -21,6 +28,13 @@ inline glm::vec4 GLparameters(GLfloat shininess, GLfloat metallic, return glm::vec4(shininess,metallic,fresnel0,0.0); } +inline ostream& operator << (ostream& out, const glm::vec4& v) +{ + out << "[" << v[0] << "," << v[1] << "," << v[2] << "," << v[3] + << "]"; + return out; +} + struct Material { public: glm::vec4 diffuse,emissive,specular; @@ -45,6 +59,7 @@ public: parameters=m.parameters; return *this; } + friend bool operator < (const Material& m1, const Material& m2) { return m1.diffuse < m2.diffuse || (m1.diffuse == m2.diffuse && @@ -54,13 +69,23 @@ public: (m1.specular == m2.specular && (m1.parameters < m2.parameters)))))); } + + friend ostream& operator << (ostream& out, const Material& m) { + out << "diffuse=" << m.diffuse << "," << newl + << "emissive=" << m.emissive << "," << newl + << "specular=" << m.specular << "," << newl + << "shininess=" << m.parameters[0] << "," << newl + << "metallic=" << m.parameters[1] << "," << newl + << "fresnel0=" << m.parameters[2] << newl; + return out; + } + }; extern size_t Nmaterials; // Number of materials compiled in shader extern size_t nmaterials; // Current size of materials buffer extern size_t Maxmaterials; // Maxinum size of materials buffer -void clearMaterialBuffer(bool draw=false); - } + #endif #endif |