#define _USE_MATH_DEFINES // for M_PI
#include <math.h>
#include "primitives.h"
#include "textures.h"
#include "xmlwriter.h"
#include <sstream>
#include <fstream>
#include <iostream>
int main(char argc, char** argv) {
try {
const bool usePhysical = true;
const bool useLua = true;
const float luaQuality = 0.0f;
const float illQuality = 0.1f;
#if defined(WIN32)
#else
#endif
const std::string dirName = "../../../temp/" + std::string(useLua?"luaSH":"illuminationSH") + (usePhysical?"Physical":"Nonphysical");
std::string whiteMatName = "whiteMaterial";
ILBMeshHandle sphereMesh = bex::createSphere(bmh,
"Sphere", whiteMatName, 32, 32);
ILBMeshHandle planeMesh = bex::createPlane(bmh,
"Plane", whiteMatName, 32, 32);
if (usePhysical) {
} else {
}
bex::Matrix4x4 rotx(bex::identity());
rotx.setRow(bex::Vec3(0,0,-1), 1);
rotx.setRow(bex::Vec3(0,1,0), 2);
bex::Matrix4x4 redTrans = bex::translation(bex::Vec3(0, 0, -1)) * rotx;
bex::Matrix4x4 blueTrans = bex::translation(bex::Vec3(0, 0, 1)) * rotx;
bex::apiCall(
ILBCreateInstance(scene, planeMesh,
"planeInstance", &bex::identity(), &planeInstance));
bex::apiCall(
ILBCreateInstance(scene, planeMesh,
"redInstance", &redTrans, &redInstance));
bex::apiCall(
ILBCreateInstance(scene, planeMesh,
"blueInstance", &blueTrans, &blueInstance));
bex::apiCall(
ILBCreatePointLight(scene,
"pointLight", &bex::translation(bex::Vec3(0.0f, 0.5f, 0.0f)), &bex::ColorRGB(1.0f, 1.0f, 1.0f), &light));
if (usePhysical) {
bex::apiCall(
ILBCreateShader(bmh,
"diffuse",
"../../data/diffuse.osl", &diffuseShader));
}
if (usePhysical) {
} else {
}
if (usePhysical) {
} else {
}
if (usePhysical) {
} else {
}
bex::Vec3 camPos(2.0f, 2.0f, 2.0f);
bex::Vec3 camLookAt(0.0f, 0.0f, 0.0f);
_T("Camera"),
&bex::setCameraMatrix(camPos, camLookAt-camPos, bex::Vec3(0.0f, 1.0f, 0.0f)),
&camera));
std::string xmlFileName = "../../data/shbaking.xml";
{
using namespace bex;
std::ofstream ofs(xmlFileName.c_str(), std::ios_base::out | std::ios_base::trunc);
XMLWriter xml(ofs);
{ScopedTag _x(xml, "ILConfig");
{ScopedTag _x(xml, "AASettings");
xml.data("minSampleRate", 0);
xml.data("maxSampleRate", 2);
}
{ScopedTag _x(xml, "RenderSettings");
xml.data("bias", 0.00001f);
}
{ScopedTag _x(xml, "GISettings");
xml.data("enableGI", true);
}
}
}
bex::apiCall(
ILBCreateJob(bmh, _T(
"TestJob"), scene, xmlFileName.c_str(), &job));
if (usePhysical) {
if (useLua) {
} else {
}
}
if (useLua) {
bex::apiCall(
ILBCreateLuaPass(job, _T(
"LUA"),
"../../data/sh_3.lua", &luaPass));
} else {
}
return 1;
}
int32 channelCount;
std::cout << "Channel count: " << channelCount << std::endl;
for (int i = 0; i < channelCount; i++) {
std::cout << i << ": " << bex::convertStringHandle(sth) << std::endl;
}
return 0;
} catch(bex::Exception& ex) {
std::cout << "Beast API error" << std::endl;
std::cout << "Error: " << bex::convertStringHandle(errorString) << std::endl;
std::cout << "Info: " << bex::convertStringHandle(extendedError) << std::endl;
return 1;
} catch(std::exception& ex) {
std::cout << "Standard exception" << std::endl;
std::cout << "Error: " << ex.what() << std::endl;;
return 1;
}
}