示例#1
0
void Renderer::drawTo(Framebuffer& framebuffer,
                      Camera& camera) const
{
    auto fbBind = make_bind(framebuffer);
    GL_CHECK(glClearColor(1.0f, 1.0f, 1.0f, 1.0f));
    clear();

    State rendererState(camera, Color::White, {});
    rendererState.isRenderingShadow = true;
    rendererState.projectionType = ProjectionType::Orthographic; // TODO

    for (const std::shared_ptr<Drawable>& d: mDrawablesBuffer) {
        d->draw(rendererState);
    }
}
示例#2
0
int main(int argc, char *argv[])
{
	if(argc > 12)
	{
		printf("Numero de argumentos incorrecto\n");
		return(EXIT_FAILURE);
	}
	

	int c_id = 0;
	struct PARAMS params;
	struct sockaddr_in sockInfo;
	
	bzero(&params, sizeof(struct PARAMS));
	bzero(&sockInfo, sizeof(struct sockaddr_in));

	params.sc   = TRIVIAL;
	params.port = 8108;
	params.rexmt = 5;

	strcpy(params.host, "localhost");
	param_parser(argc, argv, &params);

	if( (c_id = create_socket(PF_INET, SOCK_DGRAM, 0)) == -1)
	{
		printf("Error al crear el socket\n");
		exit(EXIT_FAILURE);
	}

	if(make_bind(c_id, AF_INET, 0, NULL) == -1)
	{
		printf("Error al hacer el bind\n");
		exit(EXIT_FAILURE);
	}

	sockInfo.sin_family	= AF_INET;
	sockInfo.sin_port	= htons((unsigned short int) params.port);
	sockInfo.sin_addr	= *(struct in_addr *)gethostbyname(params.host)->h_addr;
	
	switch(params.read_write)
	{
		case RFC1350_OP_RRQ:
		{
			rwqAction(c_id, sockInfo, &params);
		}break;

		case RFC1350_OP_WRQ:
		{
			wrqAction(c_id, sockInfo, &params);
		}break;

		default:
		{
			if(sendError(c_id, sockInfo, RFC1350_OP_ERROR, RFC1350_ERR_ILEGALOP, "Illegal TFTP operation") == -1)
			{
				printf("Error default case\n");
			}
		}break;			
	}

	close(c_id);
	return(EXIT_SUCCESS);
}