Author Topic: Utilities from a Tiranas  (Read 785 times)

0 Members and 1 Guest are viewing this topic.

Offline Nikolas - WS3D Developer

  • Programmer
  • Global Moderator
  • Marquess
  • *
  • Posts: 869
  • Reputation 59
Re: Utilities from a Tiranas
« Reply #135 on: September 03, 2018, 05:04:49 PM »
Привет всем.
Взялся переписывать для бейсика 81 пример с шейдерами, и нашел несоответствия. Мои недоработки.

1) В главном заголовке вместо
Code: [Select]
сonst as Float32 wShaderConstZero   =0
const as Float32 wShaderConstOne    =1
const as Float32 wShaderConstTwo    =2
const as Float32 wShaderConstThree  =3

исправил на
Code: [Select]
Dim shared as Float32 wShaderConstZero   =0
Dim shared as Float32 wShaderConstOne    =1
Dim shared as Float32 wShaderConstTwo    =2
Dim shared as Float32 wShaderConstThree  =3

из-за проблем с компиляцией.

2) Во ВСЕХ функциях из раздела wShader нужно поправить:

wShader => wShader ptr

На всякий случай вот:
Code: [Select]
'///wShader///
declare function wShaderCreateNamedVertexConstant(byval shader as wShader ptr,_
byval name as const zstring ptr,_
byval preset as Int32,_
byval floats as const Float32 ptr,_
byval count as Int32) as Boolean

declare function wShaderCreateNamedPixelConstant(byval shader as wShader ptr,_
byval name as const zstring ptr,_
byval preset as Int32,_
byval floats as const Float32 ptr,_
byval count as Int32) as Boolean

declare function wShaderCreateAddressedVertexConstant(byval shader as wShader ptr,_
byval address as Int32,_
byval preset as Int32,_
byval floats as const Float32 ptr,_
byval count as Int32) as Boolean

declare function wShaderCreateAddressedPixelConstant(byval shader as wShader ptr,_
byval address as Int32,_
byval preset as Int32,_
byval floats as const Float32 ptr,_
byval count as Int32) as Boolean

declare function wShaderAddHighLevelMaterial(byval vertexShaderProgram as const zstring ptr,_
byval vertexShaderEntryPointName as const zstring ptr,_
byval wVersion as wVertexShaderVersion,_
byval pixelShaderProgram as const zstring ptr,_
byval pixelShaderEntryPointName as const zstring ptr=@"main",_
byval pVersion as wPixelShaderVersion = wPSV_1_1,_
byval materialType as wMaterialTypes = wMT_SOLID,_
byval userData as Int32 = 0) as wShader ptr

declare function wShaderAddHighLevelMaterialFromFiles(byval vertexShaderProgramFileName as const zstring ptr,_
byval vertexShaderEntryPointName as const zstring ptr,_
byval wVersion as wVertexShaderVersion,_
byval pixelShaderProgramFileName as const zstring ptr,_
byval pixelShaderEntryPointName as const zstring ptr=@"main",_
byval pVersion as wPixelShaderVersion = wPSV_1_1,_
byval materialType as wMaterialTypes = wMT_SOLID,_
byval userData as Int32 = 0) as wShader ptr

declare function wShaderAddMaterial(byval vertexShaderProgram as const zstring ptr,_
byval pixelShaderProgram as const zstring ptr,_
byval materialType as wMaterialTypes = wMT_SOLID,_
byval userData as Int32 = 0) as wShader ptr

declare function wShaderAddMaterialFromFiles(byval vertexShaderProgramFileName as const zstring ptr,_
byval pixelShaderProgramFileName as const zstring ptr,_
byval materialType as wMaterialTypes = wMT_SOLID,_
byval userData as Int32 = 0) as wShader ptr

declare function wShaderAddHighLevelMaterialEx(byval vertexShaderProgram as const zstring ptr,_
byval vertexShaderEntryPointName as const zstring ptr,_
byval wVersion as wVertexShaderVersion,_
byval pixelShaderProgram as const zstring ptr,_
byval pixelShaderEntryPointName as const zstring ptr,_
byval pVersion as wPixelShaderVersion,_
byval geometryShaderProgram as const zstring ptr,_
byval geometryShaderEntryPointName as const zstring ptr=@"main",_
byval gVersion as wGeometryShaderVersion = wGSV_4_0,_
byval inType as wPrimitiveType = wPT_TRIANGLES,_
byval outType as wPrimitiveType = wPT_TRIANGLE_STRIP,_
byval verticesOut as UInt32 = 0,_
byval materialType as wMaterialTypes = wMT_SOLID,_
byval userData as Int32 = 0) as wShader ptr

declare function wShaderAddHighLevelMaterialFromFilesEx(byval vertexShaderProgramFileName as const zstring ptr,_
byval vertexShaderEntryPointName as const zstring ptr,_
byval wVersion as wVertexShaderVersion,_
byval pixelShaderProgramFileName as const zstring ptr,_
byval pixelShaderEntryPointName as const zstring ptr,_
byval pVersion as wPixelShaderVersion,_
byval geometryShaderProgram as const zstring ptr,_
byval geometryShaderEntryPointName as const zstring ptr=@"main",_
byval gVersion as wGeometryShaderVersion = wGSV_4_0,_
byval inType as wPrimitiveType = wPT_TRIANGLES,_
byval outType as wPrimitiveType = wPT_TRIANGLE_STRIP,_
byval verticesOut as UInt32 = 0,_
byval materialType as wMaterialTypes = wMT_SOLID,_
byval userData as Int32 = 0) as wShader ptr

Заранее благодарю товарища Tiranas.


PS В заголовке SamplrFunctions.bi появилась функция, аналогичная С-шной:

Code: [Select]
'///For shaders
function ShaderGetMaterialType(byval shader as wShader ptr)as wMaterialTypes
    return Cast(wMaterialTypes,shader->material_type)
end function
« Last Edit: September 03, 2018, 05:09:25 PM by Nikolas - WS3D Developer »
Под лежачий камень мы всегда успеем...

Offline Tiranas

  • Friends
  • Esquire
  • *
  • Posts: 60
  • Reputation 30
  • Совсем Тёмный.
Re: Utilities from a Tiranas
« Reply #136 on: September 03, 2018, 05:19:13 PM »
Nikolas - WS3D Developer
Приветствую!

Справку исправил.
Людям с более широким кругозором ведомо, что четкой границы между реальным, действительным и ирреальным воображаемым не существует, что каждый из нас, благодаря тонким физиологическим и психологическим различиям, воспринимает все явления по-своему. (Говард Филлипс Лавкрафт)

Offline Nikolas - WS3D Developer

  • Programmer
  • Global Moderator
  • Marquess
  • *
  • Posts: 869
  • Reputation 59
Re: Utilities from a Tiranas
« Reply #137 on: September 03, 2018, 05:39:58 PM »
Оперативно, однако. :)
Под лежачий камень мы всегда успеем...