Files
igl/external/embree/examples/tutorials/tutorials.isph
T

79 lines
3.0 KiB
Plaintext

// ======================================================================== //
// Copyright 2009-2013 Intel Corporation //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// you may not use this file except in compliance with the License. //
// You may obtain a copy of the License at //
// //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
// Unless required by applicable law or agreed to in writing, software //
// distributed under the License is distributed on an "AS IS" BASIS, //
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
// See the License for the specific language governing permissions and //
// limitations under the License. //
// ======================================================================== //
#ifndef __EMBREE_TUTORIALS_H__
#define __EMBREE_TUTORIALS_H__
/* size of screen tiles */
#define TILE_SIZE_X 16
#define TILE_SIZE_Y 16
/* include optional vector library */
#include "../../embree_ispc/math/math.isph"
#include "../../embree_ispc/math/vec.isph"
#include "../../embree_ispc/math/affinespace.isph"
/* include embree API and ray layout */
#include "../../embree_ispc/include/embree.isph"
#include "../../embree_ispc/include/ray.isph"
/* draws pixels to the screen */
extern "C" void DrawPixelsRGBA8 (uniform int* uniform pixels, uniform int width, uniform int height);
struct Triangle
{
int v0; /*< first triangle vertex */
int v1; /*< second triangle vertex */
int v2; /*< third triangle vertex */
int triangleID; /*< ID of triangle */
int materialID; /*< material of triangle */
};
struct Material
{
int illum; /*< illumination model */
float d; /*< dissolve factor, 1=opaque, 0=transparent */
float Ns; /*< specular exponent */
float Ni; /*< optical density for the surface (index of refraction) */
vec3f Ka; /*< ambient reflectivity */
vec3f Kd; /*< diffuse reflectivity */
vec3f Ks; /*< specular reflectivity */
vec3f Tf; /*< transmission filter */
};
struct Scene
{
uniform Material* materials; //!< material list
uniform vec3fa* positions; //!< vertex position array
uniform vec3f* normals; //!< vertex normal array
uniform vec2f* texcoords; //!< vertex texcoord array
uniform Triangle* triangles; //!< list of triangles
int numMaterials;
int numVertices;
int numTriangles;
vec3f pointLightPosition;
vec3f pointLightIntensity;
vec3f ambientLightIntensity;
};
/* returns pointer to scene */
extern "C" void* uniform getScene();
#endif