/usr/include/opencollada/COLLADAStreamWriter/COLLADASWEffectProfile.h is in opencollada-dev 0.1.0~20140703.ddf8f47+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | /*
Copyright (c) 2008-2009 NetAllied Systems GmbH
This file is part of COLLADAStreamWriter.
Licensed under the MIT Open Source License,
for details please see LICENSE file or the website
http://www.opensource.org/licenses/mit-license.php
*/
#ifndef __COLLADASTREAMWRITER_EFFECT_H__
#define __COLLADASTREAMWRITER_EFFECT_H__
#include "COLLADASWPrerequisites.h"
#include "COLLADASWElementWriter.h"
#include "COLLADASWExtraTechnique.h"
#include "COLLADASWColor.h"
#include "COLLADASWColorOrTexture.h"
#include "COLLADASWConstants.h"
#include "COLLADABUURI.h"
#include <vector>
#include <map>
namespace COLLADASW
{
/** A class to write a @a \<profile_COMMON\> element to the stream*/
class EffectProfile : public ElementWriter, public BaseExtraTechnique
{
public:
/** The possible profile types. */
enum ProfileType
{
COMMON,
CG,
GLES,
GLSL
};
/** The list of the lighting models supported by the COMMON profile of COLLADASW. */
enum ShaderType
{
/** The constant lighting model.
This lighting model uses the emissive color everywhere, without
any complex lighting calculations. It also uses the translucency
factor and the translucency color, by multiplying them together
and applying them to your standard alpha channel according to the
final lighting color.*/
CONSTANT,
/** The Lambert lighting model.
This lighting model improves on the constant lighting model by
using the dot-product between the normalized light vectors and the
polygon normals to determine how much light should affect each polygon.
This value is multiplied to the diffuse color and (1 + the ambient color). */
LAMBERT,
/** The Phong lighting model.
This lighting model improves on the Lambert lighting model by
calculating how much light is reflected by the polygons into the viewer's eye.
For this calculation, the shininess, the specular color and the reflectivity is used. */
PHONG,
/** The Blinn lighting model.
This lighting model improves on the Lambert lighting model by
calculating how much light is reflected by the polygons into the viewer's eye.
For this calculation, the shininess, the specular color and the reflectivity is used. */
BLINN,
/** Not a valid lighting model. */
UNSPECIFIED
};
enum Opaque
{
UNSPECIFIED_OPAQUE,
A_ONE,
RGB_ZERO,
A_ZERO,
RGB_ONE
};
typedef std::list< std::pair<String, String> > StringPairList;
private:
friend class LibraryEffects;
struct ExtraColorOrTextureEntry
{
ColorOrTexture colorOrTexture;
String elementSid;
StringPairList attributes;
};
typedef std::map<String, std::vector<ExtraColorOrTextureEntry> > ExtraColorOrTextureEntryByProfileName;
/**
* A text string containing the unique identifier of the element.
* This value must be unique within the instance document. Optional.
*/
String mEffectProfileId;
/** The include sid and uri for the cg profile. */
String mIncludeSid;
URI mIncludeURI;
/** For writing code directly into code tags. */
String mCodeSid;
String mCode;
/** The technique sid that is used, if no other is specified*/
static const String DEFAULT_TECHNIQUE_SID;
/** The sid of the technique element*/
String mTechniqueSid;
TagCloser mTechniqueCloser;
/** The current profile type. */
ProfileType mProfileType;
TagCloser mProfileCloser;
/** The current shader type. */
ShaderType mShaderType;
/** The ColorOrTexture-values can be sampled. */
ColorOrTexture mEmission;
String mEmissionSid;
ColorOrTexture mAmbient;
String mAmbientSid;
ColorOrTexture mDiffuse;
String mDiffuseSid;
ColorOrTexture mSpecular;
String mSpecularSid;
ColorOrTexture mTransparent;
String mTransparentSid;
ColorOrTexture mReflective;
String mReflectiveSid;
/** Just if we want to add an extra technique element to the current effect
with the information of a texture. */
ExtraColorOrTextureEntryByProfileName mExtraTechniqueColorOrTextureEntries;
/** A list with all sampled image ids, which was already written.
So you will not sample the same object a second time. */
std::vector<String> mSampledImages;
double mShininess;
String mShininessSid;
double mReflectivity;
String mReflectivitySid;
Opaque mOpaque;
double mTransparency;
String mTransparencySid;
double mIndexOfRefraction;
String mIndexOfRefractionSid;
/** The extra tag elements under the effect profile. */
BaseExtraTechnique mProfileExtra;
/** The extra tag elements under the effect profile's technique element. */
BaseExtraTechnique mProfileTechniqueExtra;
/** The extra tag elements under the effect profile's technique element. */
BaseExtraTechnique mProfileTechniqueTextureExtra;
public:
/** Constructor
@param streamWriter The stream writer the @a \<profile_COMMON\> element should be written to
*/
EffectProfile ( StreamWriter* streamWriter, const String& effectProfileId = "" );
virtual ~EffectProfile(){};
/** The extra tag elements under the effect profile. */
BaseExtraTechnique& getProfileExtra () { return mProfileExtra; }
/** The extra tag elements under the effect profile's technique element. */
BaseExtraTechnique& getProfileTechniqueExtra () { return mProfileTechniqueExtra; }
/**
* A text string containing the unique identifier of the element.
* This value must be unique within the instance document. Optional.
*/
const COLLADASW::String& getEffectProfileId () const { return mEffectProfileId; }
void setEffectProfileId ( const COLLADASW::String& val ) { mEffectProfileId = val; }
/** The current profile type. */
const EffectProfile::ProfileType& getProfileType () const { return mProfileType; }
/** The current profile type. */
void setProfileType ( const EffectProfile::ProfileType& val ) { mProfileType = val; }
/** Opens the current profile. */
void openProfile ();
/** Close the current profile. */
void closeProfile ();
/** Adds the EffectProfile to the stream*/
void addProfileElements ();
/** Opens a technique element with the given sid. */
void openTechnique ( const String& techniqueSid );
/** Close the current technique element. */
void closeTechnique ();
/** Sets the sid of the @a \<technique\> element*/
void setTechniqueSid ( const String& techniqueSid );
/** Returns the sid of the @a \<technique\> element*/
const String& getTechniqueSid () const;
/** Sets the shader type to @a shaderType */
void setShaderType( ShaderType shaderType );
/** Returns the shader type */
ShaderType getShaderType() const;
/** Reference to the included file. */
void setInclude ( const URI &includeUri, const String &sid="" );
const URI & getIncludeURI() { return mIncludeURI; }
/** For writing code directly into code tags. */
const String& getCode () const;
void setCode ( const String &code, const String &sid="" );
/** Sets the emission to @a emission */
void setEmission(
const ColorOrTexture& emission,
const bool useDefaultSid = false,
const String& sid = "" );
/** Returns the default sid used for the emission element*/
static const String& getEmissionDefaultSid();
/** Returns a reference to the emission*/
ColorOrTexture& getEmission();
/** Sets the ambient to @a ambient */
void setAmbient(
const ColorOrTexture& ambient,
const bool useDefaultSid = false,
const String& sid = "" );
/** Returns the default sid used for the ambient element*/
static const String& getAmbientDefaultSid();
/** Returns a reference to ambient*/
ColorOrTexture& getAmbient();
/** Sets the diffuse to @a diffuse */
void setDiffuse(
const ColorOrTexture& diffuse,
const bool useDefaultSid = false,
const String& sid = "" );
/** Returns the default sid used for the diffuse element*/
static const String& getDiffuseDefaultSid();
/** Returns a reference to diffuse*/
ColorOrTexture& getDiffuse();
/** Sets the specular to @a specular */
void setSpecular(
const ColorOrTexture& specular,
const bool useDefaultSid = false,
const String& sid = "" );
/** Returns the default sid used for the specular element*/
static const String& getSpecularDefaultSid();
/** Returns a reference to specular*/
ColorOrTexture& getSpecular();
/** Sets the shininess to @a shininess */
void setShininess( double shininess, const bool useDefaultSid = false, const String& sid = "" );
/** Returns the default sid used for the shininess element*/
static const String& getShininessDefaultSid() { return CSWC::CSW_ELEMENT_SHININESS; }
/** Returns the shininess*/
double getShininess() const;
/** Sets the reflective to @a reflective */
void setReflective(
const ColorOrTexture& reflective,
const bool useDefaultSid = false,
const String& sid = "" );
/** Returns the default sid used for the reflective element*/
static const String& getReflectiveDefaultSid();
/** Returns a reference to reflective*/
ColorOrTexture& getReflective();
/** Sets the reflectivity to @a reflectivity */
void setReflectivity( double reflectivity, const bool useDefaultSid = false, const String& sid = "" );
/** Returns the default sid used for the reflectivity element*/
static const String& getReflectivityDefaultSid();
/** Sets the transparent to @a transparent */
void setTransparent(
const ColorOrTexture& transparent,
const bool useDefaultSid = false,
const String& sid = "" );
/** Returns the default sid used for the transparent element*/
static const String& getTransparentDefaultSid();
/** Returns a reference to transparent*/
ColorOrTexture& getTransparent();
/** Sets the opaque attribute of transparent to @a opaque */
void setOpaque( Opaque opaque);
/** Sets the opaque attribute of transparent to @a opaque */
Opaque getOpaque();
/** Sets the transparency to @a transparency */
void setTransparency( double transparency, const bool useDefaultSid = false, const String& sid = "" );
/** Returns the default sid used for the transparency element*/
static const String& getTransparencyDefaultSid() { return CSWC::CSW_ELEMENT_TRANSPARENCY; }
/** Sets the indexOfRefrection to @a indexOfRefrection */
void setIndexOfRefraction(
double indexOfRefrection,
const bool useDefaultSid = false,
const String& sid = "" );
/** Returns the default sid used for the indexOfRefrection element*/
static const String& getIndexOfRefractionSid();
/**
* Adds extra technique tags to the current effect and writes
* the child element with the given colorOrTexture element in the tags.
* @param profileName Name of the technique.
* @param childElement Name of the colorOrTexture child element.
* @param colorOrTexture The colorOrTexture to set.
*/
void addExtraTechniqueColorOrTexture ( const ColorOrTexture& colorOrTexture, const StringPairList& attributes = StringPairList(), const String& sid = "" );
/** Add the sampler required by @a colorOrTexture to the stream*/
void addSampler ( const ColorOrTexture &colorOrTexture );
private:
/** Adds the EffectProfile to the stream*/
void addProfileCommon ();
/** Adds the EffectProfile to the stream*/
void addProfileCG ();
void addProfileGLSL ();
void addProfileGLES ();
/** Add the samplers required by the textures to the stream*/
void addSamplers();
/** Returns the element name of the profile type. */
static const String& getProfileTypeName ( ProfileType profileType );
/** Returns the element name of the shader. */
static const String& getShaderTypeName ( ShaderType shaderType );
/** Returns a reference to the COLLADASW name of the opaque type*/
static const String& getOpaqueString ( Opaque opaque );
/** Adds element @a elementName and adds @a colorOrTexture to it.*/
void addColorOrTexture (
const String &elementName,
const ColorOrTexture &colorOrTexture,
const String &elementSid,
StringPairList attributes = StringPairList(),
Opaque opaque = UNSPECIFIED_OPAQUE ) const;
/** Adds element @a elementName and adds @a number to it.*/
void addFloat (
const String &elementName,
const double &number,
const String &elementSid ) const;
/**
* Adds extra technique tags to the current effect and writes
* the child element with the given colorOrTexture element in the tags.
* @param profileName Name of the technique.
* @param childElement Name of the colorOrTexture child element.
* @param colorOrTexture The colorOrTexture to set.
*/
void addExtraTechniqueColorOrTextures (
const ExtraColorOrTextureEntryByProfileName &entriesByProfileName ) const;
};
} //namespace COLLADASW
#endif //__COLLADASTREAMWRITER_EFFECT_H__
|