This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diffuseCanvas = sfg::Canvas::Create(true); | |
diffuseCanvas->SetRequisition(sf::Vector2f(40,40)); | |
diffuseCanvas->Bind(); | |
diffuseCanvas->Clear( sf::Color::Blue, true ); | |
diffuseCanvas->Unbind(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <materialAdjuster.h> | |
#include <iostream> | |
#include <string> | |
// Here is a small helper for you ! Have a look. | |
#include "ResourcePath.hpp" | |
#include "scene.h" | |
//Utility for GUI stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// materialAdjuster.cpp | |
// raytracer | |
// | |
// Created by Noah on 17/01/14. | |
// Copyright (c) 2014 syx. All rights reserved. | |
// | |
#include "materialAdjuster.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Color Scene::TraceRay (const Ray& ray, double rIndex, int iterations) const{ | |
Color pixel = Black; | |
Intersection intersection = Intersect(ray); | |
if (intersection.t != -1) { | |
pixel += ambientColor * intersection.shape->getMaterial()->getAmbient(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Color Scene::TraceRay (const Ray& ray, double rIndex, int iterations) const{ | |
Color pixel = Black; | |
Intersection intersection = Intersect(ray); | |
if (intersection.t != -1) { | |
pixel += ambientColor * intersection.shape->getMaterial()->getAmbient(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MaterialAdjuster::addMaterial(Material* material){ | |
materialSelector->AppendItem(material->getName()); | |
//materialSelector->SelectItem(0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void RenderGUI::startRenderThread(){ | |
if(renderThread.joinable()){ | |
renderThread.detach(); | |
renderThread.~thread(); | |
} | |
scene.allowRendering(true); | |
renderThread = std::thread(&RenderGUI::renderScene, this); | |
render->SetLabel("Abort"); | |
render->GetSignal(sfg::Widget::OnLeftClick).Disconnect(renderButtonEvent); | |
renderButtonEvent = render->GetSignal(sfg::Widget::OnLeftClick).Connect(std::bind( &RenderGUI::startRenderThread, this)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RenderGUI::RenderGUI(Scene &scene): | |
scene(scene), | |
renderButtonEvent(0){ | |
render = sfg::Button::Create("Render"); | |
renderButtonEvent = render->GetSignal(sfg::Widget::OnLeftClick).Connect(std::bind(&RenderGUI::startRenderThread, this)); | |
progress = sfg::ProgressBar::Create(); | |
antialiasing = sfg::CheckButton::Create("AntiAliasing"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void RenderGUI::startRenderThread(){ | |
if(renderThread.joinable()){ | |
renderThread.detach(); | |
renderThread.~thread(); | |
} | |
scene.allowRendering(true); | |
renderThread = std::thread(&RenderGUI::renderScene, this); | |
// render->SetLabel("Abort"); | |
// if(renderButtonEvent != 0) | |
// render->GetSignal(sfg::Widget::OnLeftClick).Disconnect(renderButtonEvent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void generate(int[] standings){ | |
int[] copy = new int[10]; | |
System.arraycopy( standings, 0, copy, 0, standings.length ); | |
table[copy[0] * 1 + copy[1] * 3 + copy[2] * 9 + copy[3] * 27 + copy[4] * 81 + copy[5] * 243 | |
+ copy[6] * 729 + copy[7] * 2187 + copy[8] * 6561 + copy[9] * 19683] = 1; | |
for(int i = 0; i < 10; i++){ | |
if(copy[i] < 2){ | |
copy[i]++; | |
generate(copy); | |
} |
OlderNewer