def get_cmap_res(self): res = self._h3dres.lightMat cnt = h3d.getResElemCount(res, h3d.MatRes.SamplerElem) for i in range(cnt): uni_name = h3d.getResParamStr(res, h3d.MatRes.SamplerElem, i, h3d.MatRes.SampNameStr) if uni_name == 'causticMap': h3d.setResParamI(res, h3d.MatRes.SamplerElem, i, h3d.MatRes.SampTexResI, self._h3dres.cmap) break res = h3d.findResource(h3d.ResTypes.Shader, 'shaders/sph_lighting.shader') if res != 0: cnt = h3d.getResElemCount(res, h3d.ShaderRes.UniformElem) for i in range(cnt): uni_name = h3d.getResParamStr(res, h3d.ShaderRes.UniformElem, i, h3d.ShaderRes.UnifNameStr) if uni_name in self.cmap_mat: self.cmap_mat[uni_name] = i self.ligth_shader_res = res res = h3d.findResource(h3d.ResTypes.Shader, 'shaders/sph_fluid.shader') if res != 0: cnt = h3d.getResElemCount(res, h3d.ShaderRes.UniformElem) for i in range(cnt): uni_name = h3d.getResParamStr(res, h3d.ShaderRes.UniformElem, i, h3d.ShaderRes.UnifNameStr) if uni_name == 'cameraFov': self.fov_slot = i break self.sph1_shader_res = res
def get_cmap_res(self) : res = self._h3dres.lightMat cnt = h3d.getResElemCount(res, h3d.MatRes.SamplerElem) for i in range(cnt) : uni_name = h3d.getResParamStr(res, h3d.MatRes.SamplerElem, i, h3d.MatRes.SampNameStr) if uni_name == 'causticMap' : h3d.setResParamI(res, h3d.MatRes.SamplerElem, i, h3d.MatRes.SampTexResI, self._h3dres.cmap) break res = h3d.findResource(h3d.ResTypes.Shader, 'shaders/sph_lighting.shader') if res != 0 : cnt = h3d.getResElemCount(res, h3d.ShaderRes.UniformElem) for i in range(cnt) : uni_name = h3d.getResParamStr(res, h3d.ShaderRes.UniformElem, i, h3d.ShaderRes.UnifNameStr) if uni_name in self.cmap_mat : self.cmap_mat[uni_name] = i self.ligth_shader_res = res res = h3d.findResource(h3d.ResTypes.Shader, 'shaders/sph1.shader') if res != 0 : cnt = h3d.getResElemCount(res, h3d.ShaderRes.UniformElem) for i in range(cnt) : uni_name = h3d.getResParamStr(res, h3d.ShaderRes.UniformElem, i, h3d.ShaderRes.UnifNameStr) if uni_name == 'cameraFov' : self.fov_slot = i break self.sph1_shader_res = res
def get_cmap_res(self) : # print self.light_material_name res = h3d.findResource(h3d.ResTypes.Material, self.light_material_name) idx = get_smapler_by_name(res, 'causticMap') if idx >= 0 : h3d.setResParamI(res, h3d.MatRes.SamplerElem, idx, h3d.MatRes.SampTexResI, self.cmap) else : print "Get error caustic map id" self.light_mat_res = res # get light matrix uniform id res = h3d.findResource(h3d.ResTypes.Shader, self.light_shader_name) if res != 0 : cnt = h3d.getResElemCount(res, h3d.ShaderRes.UniformElem) for i in range(cnt) : uni_name = h3d.getResParamStr(res, h3d.ShaderRes.UniformElem, i, h3d.ShaderRes.UnifNameStr) if uni_name in self.cmap_mat : self.cmap_mat[uni_name] = i self.light_shader_res = res else: print "Get error light shader id" res = h3d.findResource(h3d.ResTypes.Shader, 'shaders/sph_fluid.shader') if res != 0 : cnt = h3d.getResElemCount(res, h3d.ShaderRes.UniformElem) for i in range(cnt) : uni_name = h3d.getResParamStr(res, h3d.ShaderRes.UniformElem, i, h3d.ShaderRes.UnifNameStr) if uni_name == 'cameraFov' : self.fov_slot = i break self.sph1_shader_res = res else : print "Get error fluid shader id"
def get_smapler_by_name(self, res, name): cnt = h3d.getResElemCount(res, h3d.MatRes.SamplerElem) for i in range(cnt): uni_name = h3d.getResParamStr(res, h3d.MatRes.SamplerElem, i, h3d.MatRes.SampNameStr) if uni_name == name: return i return -1
def get_smapler_by_name(res, name): if 0 == res : print 'Error resource' return cnt = h3d.getResElemCount(res, h3d.MatRes.SamplerElem) for i in range(cnt) : uni_name = h3d.getResParamStr(res, h3d.MatRes.SamplerElem, i, h3d.MatRes.SampNameStr) if uni_name == name : return i return -1
def get_smapler_by_name(self, res, name): cnt = h3d.getResElemCount(res, h3d.MatRes.SamplerElem) for i in range(cnt) : uni_name = h3d.getResParamStr(res, h3d.MatRes.SamplerElem, i, h3d.MatRes.SampNameStr) if uni_name == name : return i return -1