
This file was automatically generated from diguyOglGraphicsShaderTechnique.cpp. Do not edit this file directly; the changes will be lost.
#include <string> #include <diguyScenario.h> #include <diguyApp.h> #include "diguyOglGraphicsShaderTechnique.h" #include "diguyOglGraphicsShaderProgram.h" diguyOglGraphicsShaderTechnique::diguyOglGraphicsShaderTechnique(void* internal_data) : diguyGraphicsShaderTechnique(internal_data) { ; } diguyOglGraphicsShaderTechnique::~diguyOglGraphicsShaderTechnique() { ; } //virtual diguyGraphicsShaderProgram * diguyOglGraphicsShaderTechnique::pick_shader_program(const diguyShaderPickDescription & desc) { /* You can just do this if you want default behavior * return diguyGraphicsShaderProgram::pick_shader_program(desc); */ if(desc.m_current_render_flags & DIGUY_RENDER_PASS_INTERSECTION) { return get_intersection_shader(); } else if(desc.m_current_render_flags & DIGUY_RENDER_PASS_SHADOW ){ return get_shadow_pass_shader(); } else { // automatic shader LOD are specified if(desc.m_shader_lod == -1) { //The simple case is just to do: //return get_shader_by_distance( desc.m_render_distance, desc.m_max_quality_level); int index = get_program_index_by_distance(desc.m_render_distance / desc.m_shader_lod_bias, desc.m_max_quality_level); if(index != -1) { diguyScenario * scenario = diguyApp::get_app()->get_scenario_at_index(0); int num_effects = scenario->get_num_active_fire_effects(); if(num_effects > 0){ diguyGraphicsShaderProgram * program = m_shaders_with_point_lights[index]; if(program){ return program; } } else{ return get_shader_lod_program_at_index(index); } } } else { if(desc.m_shader_lod > get_num_shader_lod_programs()){ return get_shader_lod_program_at_index(get_num_shader_lod_programs()-1); } else{ return get_shader_lod_program_at_index(desc.m_shader_lod-1); } } } // falls back to the default behavior return NULL; }; void diguyOglGraphicsShaderTechnique::build() { int i; for(i = 0; i < get_num_shader_lod_programs(); i++) { diguyOglGraphicsShaderProgram* program = dynamic_cast<diguyOglGraphicsShaderProgram *>(get_shader_lod_program_at_index(i)); diguyOglGraphicsShaderProgram * new_program = NULL; // the base program defaults to off so we can detect and turn on if(program && program->m_bind_location_ufrm_light_array != -1 || program->has_additional_feature("POINT_LIGHT_SUPPORT")) { std::string new_program_name = program->get_name(); new_program_name += ":point_lights"; //printf("Compiling additional shader '%s' \n", new_program_name.c_str()); new_program = dynamic_cast<diguyOglGraphicsShaderProgram *>(find_or_create_shader_variation(program, new_program_name.c_str())); new_program->m_include_point_lights = 1; new_program->load(); } m_shaders_with_point_lights.push_back(new_program); if(new_program){ add_additional_shader(new_program); } } }
| Create function definition |
Create and return an object of a subclass of diguyGraphicsShaderTechnique. This function will be called whenever DI-Guy requires a shader technique object.
diguyGraphicsShaderTechnique* diguyOglGraphicsShaderTechnique_create_func(void* internal_data) { return new diguyOglGraphicsShaderTechnique(internal_data); }
ALL RIGHTS RESERVED.
These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.
RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.
Contractor/Manufacturer is:
Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.