working on distribution infrastructure some more, ssh working
git-svn-id: svn://anubis/fart/trunk@222 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
74399fe145
commit
1dbe7040e4
@ -53,10 +53,14 @@ int distrib::connect(const string & host)
|
|||||||
}
|
}
|
||||||
else /* in the child */
|
else /* in the child */
|
||||||
{
|
{
|
||||||
|
char server_port_str[15];
|
||||||
|
sprintf(server_port_str, "%d", m_serverport);
|
||||||
execlp("ssh", "ssh", host.c_str(),
|
execlp("ssh", "ssh", host.c_str(),
|
||||||
"fart", "--host", m_servername.c_str(),
|
"fart", "--host", m_servername.c_str(),
|
||||||
"--port", m_serverport,
|
"--port", server_port_str,
|
||||||
NULL);
|
(char *) NULL);
|
||||||
|
|
||||||
|
/* we should not get here */
|
||||||
cerr << "Error " << errno << " with execlp()!" << endl;
|
cerr << "Error " << errno << " with execlp()!" << endl;
|
||||||
exit(33);
|
exit(33);
|
||||||
}
|
}
|
||||||
@ -66,6 +70,8 @@ int distrib::connect(const string & host)
|
|||||||
|
|
||||||
int distrib::startServer()
|
int distrib::startServer()
|
||||||
{
|
{
|
||||||
|
connect();
|
||||||
|
|
||||||
char hostname[1000];
|
char hostname[1000];
|
||||||
gethostname(&hostname[0], 1000);
|
gethostname(&hostname[0], 1000);
|
||||||
m_servername = hostname;
|
m_servername = hostname;
|
||||||
@ -105,3 +111,8 @@ int distrib::startServer()
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int distrib::startClient(const char * server, int port)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -9,11 +9,13 @@ class distrib
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int readHostFile(const char * filename);
|
int readHostFile(const char * filename);
|
||||||
int connect();
|
|
||||||
int startServer();
|
int startServer();
|
||||||
|
int startClient(const char * server, int port);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
int connect();
|
||||||
int connect(const std::string & host);
|
int connect(const std::string & host);
|
||||||
|
|
||||||
std::vector<std::string> m_hosts;
|
std::vector<std::string> m_hosts;
|
||||||
std::vector<int> m_children;
|
std::vector<int> m_children;
|
||||||
std::string m_servername;
|
std::string m_servername;
|
||||||
|
@ -29,6 +29,7 @@ Scene::Scene(const map<string, const char *> & options,
|
|||||||
m_ambient_light = Color(0.2, 0.2, 0.2);
|
m_ambient_light = Color(0.2, 0.2, 0.2);
|
||||||
m_max_depth = 10;
|
m_max_depth = 10;
|
||||||
m_transforms.push(Transform());
|
m_transforms.push(Transform());
|
||||||
|
m_server = true;
|
||||||
|
|
||||||
load(filename);
|
load(filename);
|
||||||
|
|
||||||
@ -65,6 +66,31 @@ Scene::Scene(const map<string, const char *> & options,
|
|||||||
{
|
{
|
||||||
m_verbose = true;
|
m_verbose = true;
|
||||||
}
|
}
|
||||||
|
else if (it->first == "host")
|
||||||
|
{
|
||||||
|
m_server_name = it->second;
|
||||||
|
m_server = false;
|
||||||
|
}
|
||||||
|
else if (it->first == "port")
|
||||||
|
{
|
||||||
|
m_server_port = atoi(it->second);
|
||||||
|
}
|
||||||
|
else if (it->first == "hosts")
|
||||||
|
{
|
||||||
|
m_hosts_file = it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* start the distribution infrastructure */
|
||||||
|
if (m_server)
|
||||||
|
{
|
||||||
|
if (m_hosts_file != "")
|
||||||
|
m_distrib.readHostFile(m_hosts_file.c_str());
|
||||||
|
m_distrib.startServer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_distrib.startClient(m_server_name.c_str(), m_server_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* view plane distance is calculated based on the field of view */
|
/* view plane distance is calculated based on the field of view */
|
||||||
|
14
main/Scene.h
14
main/Scene.h
@ -7,16 +7,21 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
|
||||||
#include "util/refptr.h"
|
#include "util/refptr.h"
|
||||||
#include "util/Ray.h"
|
#include "util/Ray.h"
|
||||||
#include "util/Color.h"
|
#include "util/Color.h"
|
||||||
#include "util/Material.h"
|
#include "util/Material.h"
|
||||||
|
|
||||||
|
#include "distrib/distrib.h"
|
||||||
|
|
||||||
#include "shapes/shapes.h"
|
#include "shapes/shapes.h"
|
||||||
#include "Light.h"
|
|
||||||
|
|
||||||
#include "parser/parser.h"
|
#include "parser/parser.h"
|
||||||
#include "parser/nodes.h"
|
#include "parser/nodes.h"
|
||||||
|
|
||||||
|
#include "Light.h"
|
||||||
|
|
||||||
#define SCENE_FACTOR_THRESHOLD 0.02
|
#define SCENE_FACTOR_THRESHOLD 0.02
|
||||||
|
|
||||||
class Scene
|
class Scene
|
||||||
@ -84,6 +89,13 @@ class Scene
|
|||||||
double m_half_sample_span;
|
double m_half_sample_span;
|
||||||
std::map< std::string, refptr<Material> > m_materials;
|
std::map< std::string, refptr<Material> > m_materials;
|
||||||
|
|
||||||
|
/* distribution infrastructure */
|
||||||
|
bool m_server;
|
||||||
|
std::string m_server_name;
|
||||||
|
std::string m_hosts_file;
|
||||||
|
int m_server_port;
|
||||||
|
distrib m_distrib;
|
||||||
|
|
||||||
/* framebuffer */
|
/* framebuffer */
|
||||||
unsigned char * m_data;
|
unsigned char * m_data;
|
||||||
};
|
};
|
||||||
|
22
main/fart.cc
22
main/fart.cc
@ -20,6 +20,7 @@ void usage(const char * progname)
|
|||||||
cout << " -m|--multisample <level>" << endl;
|
cout << " -m|--multisample <level>" << endl;
|
||||||
cout << " -f|--field-of-view <vertical-fov>" << endl;
|
cout << " -f|--field-of-view <vertical-fov>" << endl;
|
||||||
cout << " -d|--max-depth <max-recursion-depth>" << endl;
|
cout << " -d|--max-depth <max-recursion-depth>" << endl;
|
||||||
|
cout << " --hosts <hosts-file>" << endl;
|
||||||
cout << " -v|--verbose" << endl;
|
cout << " -v|--verbose" << endl;
|
||||||
exit(42);
|
exit(42);
|
||||||
}
|
}
|
||||||
@ -31,7 +32,6 @@ int main(int argc, char * argv[])
|
|||||||
map<string, const char *> scene_options;
|
map<string, const char *> scene_options;
|
||||||
|
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{ "help", no_argument, NULL, 256 },
|
|
||||||
{ "output-file", required_argument, NULL, 'o' },
|
{ "output-file", required_argument, NULL, 'o' },
|
||||||
{ "width", required_argument, NULL, 'w' },
|
{ "width", required_argument, NULL, 'w' },
|
||||||
{ "height", required_argument, NULL, 'h' },
|
{ "height", required_argument, NULL, 'h' },
|
||||||
@ -39,6 +39,10 @@ int main(int argc, char * argv[])
|
|||||||
{ "field-of-view", required_argument, NULL, 'f' },
|
{ "field-of-view", required_argument, NULL, 'f' },
|
||||||
{ "max-depth", required_argument, NULL, 'd' },
|
{ "max-depth", required_argument, NULL, 'd' },
|
||||||
{ "verbose", no_argument, NULL, 'v' },
|
{ "verbose", no_argument, NULL, 'v' },
|
||||||
|
{ "help", no_argument, NULL, 256 },
|
||||||
|
{ "host", required_argument, NULL, 257 },
|
||||||
|
{ "port", required_argument, NULL, 258 },
|
||||||
|
{ "hosts", required_argument, NULL, 259 },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -47,9 +51,6 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 256:
|
|
||||||
usage(argv[0]);
|
|
||||||
break;
|
|
||||||
case 'o':
|
case 'o':
|
||||||
scene_options["output-file"] = optarg;
|
scene_options["output-file"] = optarg;
|
||||||
break;
|
break;
|
||||||
@ -71,8 +72,21 @@ int main(int argc, char * argv[])
|
|||||||
case 'v':
|
case 'v':
|
||||||
scene_options["verbose"] = optarg;
|
scene_options["verbose"] = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 256:
|
||||||
|
usage(argv[0]);
|
||||||
|
break;
|
||||||
|
case 257:
|
||||||
|
scene_options["host"] = optarg;
|
||||||
|
break;
|
||||||
|
case 258:
|
||||||
|
scene_options["port"] = optarg;
|
||||||
|
break;
|
||||||
|
case 259:
|
||||||
|
scene_options["hosts"] = optarg;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user