BRL-CAD
sh_osl.cpp File Reference
#include "common.h"
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "./liboslrend.h"
#include "vmath.h"
#include "raytrace.h"
#include "optical.h"
#include "light.h"
Include dependency graph for sh_osl.cpp:

Go to the source code of this file.

Data Structures

struct  osl_specific
 

Macros

#define OSL_MAGIC   0x1837 /* make this a unique number for each shader */
 
#define CK_OSL_SP(_p)   BU_CKMAG(_p, OSL_MAGIC, "osl_specific")
 
#define SHDR_NULL   ((struct osl_specific *)0)
 
#define SHDR_O(m)   bu_offsetof(struct osl_specific, m)
 

Functions

HIDDEN int osl_setup (register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
 
HIDDEN int osl_render (struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
 
HIDDEN void osl_print (register struct region *rp, void *dp)
 
HIDDEN void osl_free (void *cp)
 
int osl_parse_edge (char *edge, ShaderEdge &sh_edge)
 
int osl_parse_shader (char *shadername, ShaderInfo &sh_info)
 
int osl_parse (const struct bu_vls *in_vls, ShaderGroupInfo &group_info)
 
int osl_refraction_hit (struct application *ap, struct partition *PartHeadp, struct seg *finished_segs)
 

Variables

OSLRendereroslr = NULL
 
std::vector< struct resource * > visited_addrs
 
std::vector< void * > thread_infos
 
int(* default_a_hit )(struct application *, struct partition *, struct seg *)
 
int(* default_a_miss )(struct application *)
 
struct bu_structparse osl_print_tab []
 
struct mfuncs osl_mfuncs []
 

Macro Definition Documentation

#define OSL_MAGIC   0x1837 /* make this a unique number for each shader */

Definition at line 43 of file sh_osl.cpp.

Referenced by osl_setup().

#define CK_OSL_SP (   _p)    BU_CKMAG(_p, OSL_MAGIC, "osl_specific")

Definition at line 44 of file sh_osl.cpp.

Referenced by osl_render().

#define SHDR_NULL   ((struct osl_specific *)0)

Definition at line 77 of file sh_osl.cpp.

#define SHDR_O (   m)    bu_offsetof(struct osl_specific, m)

Definition at line 78 of file sh_osl.cpp.

Function Documentation

HIDDEN int osl_setup ( register struct region rp,
struct bu_vls matparm,
void **  dpp,
const struct mfuncs *  mfp,
struct rt_i rtip 
)

Definition at line 370 of file sh_osl.cpp.

References OSLRenderer::AddShader(), BU_CK_VLS, BU_GET, bu_log(), bu_struct_print(), osl_specific::magic, OSL_MAGIC, osl_parse(), rdebug, RDEBUG_SHADE, region::reg_name, RT_CHECK_RTI, RT_CK_REGION, and osl_specific::shader_ref.

Here is the call graph for this function:

HIDDEN void osl_print ( register struct region rp,
void *  dp 
)

Definition at line 419 of file sh_osl.cpp.

References bu_struct_print(), and region::reg_name.

Here is the call graph for this function:

HIDDEN void osl_free ( void *  cp)

Definition at line 425 of file sh_osl.cpp.

References BU_PUT.

int osl_parse_edge ( char *  edge,
ShaderEdge sh_edge 
)

Definition at line 112 of file sh_osl.cpp.

References ShaderParam::layername, ShaderParam::paramname, and strtok().

Referenced by osl_parse().

Here is the call graph for this function:

int osl_parse_shader ( char *  shadername,
ShaderInfo sh_info 
)

Definition at line 151 of file sh_osl.cpp.

References BU_STR_EQUAL, ShaderInfo::cparam, ShaderInfo::fparam, ShaderInfo::iparam, ShaderInfo::layername, ShaderInfo::mparam, ShaderInfo::shadername, ShaderInfo::sparam, strtok(), and ShaderInfo::vparam.

Referenced by osl_parse().

Here is the call graph for this function:

int osl_parse ( const struct bu_vls in_vls,
ShaderGroupInfo group_info 
)

This function parses the input shaders Example: shadername=color::Cin::point#0.0#0.0#1.0 shadername=glass shadername=checker::K::float#4.0 join=color::Cout::shader::Cin1 join=glass::Cout::shader::Cin1

Definition at line 278 of file sh_osl.cpp.

References BU_CK_VLS, bu_log(), BU_STR_EQUAL, bu_vls_addr(), bu_vls_free(), BU_VLS_INIT_ZERO, bu_vls_vlscat(), osl_parse_edge(), osl_parse_shader(), ShaderGroupInfo::shader_edges, and ShaderGroupInfo::shader_layers.

Referenced by osl_setup().

Here is the call graph for this function:

int osl_refraction_hit ( struct application ap,
struct partition PartHeadp,
struct seg finished_segs 
)

Definition at line 436 of file sh_osl.cpp.

References application::a_color, application::a_ray, memset(), partition::pt_forw, partition::pt_outflip, partition::pt_outhit, partition::pt_outseg, partition::pt_regionp, xray::r_dir, xray::r_pt, region::reg_mfuncs, region::reg_udata, RT_HIT_NORMAL, seg::seg_stp, and VSETALL.

Referenced by osl_render().

Here is the call graph for this function:

Variable Documentation

OSLRenderer* oslr = NULL

Definition at line 47 of file sh_osl.cpp.

std::vector<struct resource *> visited_addrs

Definition at line 52 of file sh_osl.cpp.

Referenced by osl_render().

std::vector<void *> thread_infos

Definition at line 55 of file sh_osl.cpp.

Referenced by osl_render().

int(* default_a_hit) (struct application *, struct partition *, struct seg *)

Definition at line 58 of file sh_osl.cpp.

Referenced by osl_render().

int(* default_a_miss) (struct application *)

Definition at line 60 of file sh_osl.cpp.

Referenced by osl_render().

struct bu_structparse osl_print_tab[]
Initial value:
= {
{"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
}
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153

Definition at line 81 of file sh_osl.cpp.

struct mfuncs osl_mfuncs[]
Initial value:
= {
{MF_MAGIC, "osl", 0, MFI_NORMAL|MFI_HIT|MFI_UV, 0, osl_setup, osl_render, osl_print, osl_free },
{0, (char *)0, 0, 0, 0, 0, 0, 0, 0 }
}
HIDDEN int osl_render(struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_osl.cpp:509
#define MF_MAGIC
Definition: magic.h:205
HIDDEN void osl_print(register struct region *rp, void *dp)
Definition: sh_osl.cpp:419
HIDDEN void osl_free(void *cp)
Definition: sh_osl.cpp:425
HIDDEN int osl_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_osl.cpp:370

Definition at line 106 of file sh_osl.cpp.

Referenced by optical_shader_init().