用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隐藏过滤条件
flash.display3D 

Program3D  - AS3

x

顶级
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

语言元素

全局常量
全局函数
运算符
语句、关键字和指令
特殊类型

附录

新增内容
编译器错误
编译器警告
运行时错误
迁移到 ActionScript 3
支持的字符集
仅适用于 MXML 的标签
Motion XML 元素
Timed Text 标记
不推荐使用的元素的列表
AccessibilityImplementation 常量
如何使用 ActionScript 示例
法律声明
flash.display3D
public final class Program3D
继承Program3D Inheritance Object

语言版本: ActionScript 3.0
运行时版本: Flash Player 11, AIR 2

Program3D 类表示上载到渲染上下文的一对渲染程序(也称为“着色器”)。

由 Program3D 对象管理的程序控制 drawTriangles 调用期间的整个三角形渲染。使用 upload 方法将二进制字节码上载到渲染上下文。(上载完成后,将不再引用原始字节数组中的数据;更改或放弃源字节数组不会更改该程序。)

这些程序始终由两个相互关联的部分组成:顶点程序和片段程序。

  1. 顶点程序会操作 VertexBuffer3D 中定义的数据,负责将顶点投影到剪辑空间,并将任何所需的顶点数据(例如颜色)传递到片段着色器。
  2. 片段着色器会操作顶点程序传递给它的属性,并为三角形的每个栅格化片段生成颜色,最终形成像素颜色。请注意,片段程序在 3D 编程文献中具有多个名称,包括片段着色器和像素着色器。

通过将相应 Program3D 实例传递到 Context3D setProgram() 方法,指定后续渲染操作要使用的程序对。

您无法直接创建 Program3D 对象;请改用 Context3D createProgram() 方法。

相关 API 元素



公共属性
 属性由以下参数定义
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
公共方法
 方法由以下参数定义
  
释放与此对象相关联的所有资源。
Program3D
 Inherited
表示对象是否已经定义了指定的属性。
Object
 Inherited
表示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
表示指定的属性是否存在、是否可枚举。
Object
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。
Object
 Inherited
返回指定对象的字符串表示形式。
Object
  
upload(vertexProgram:ByteArray, fragmentProgram:ByteArray):void
上载以 AGAL(Adobe 图形汇编语言)字节码表示的一对渲染程序。
Program3D
 Inherited
返回指定对象的原始值。
Object
方法详细信息

dispose

()方法
public function dispose():void

语言版本: ActionScript 3.0
运行时版本: Flash Player 11, AIR 3

释放与此对象相关联的所有资源。处置 Program3D 对象后,使用此对象调用 upload() 和渲染将失败。

upload

()方法 
public function upload(vertexProgram:ByteArray, fragmentProgram:ByteArray):void

语言版本: ActionScript 3.0
运行时版本: Flash Player 11, AIR 3

上载以 AGAL(Adobe 图形汇编语言)字节码表示的一对渲染程序。

使用 Pixel Bender 3D 脱机工具可创建程序字节码,也可动态创建。AGALMiniAssembler 类是用于将 AGAL 汇编语言程序编译为 AGAL 字节码的实用工具类。该类不是运行时的一部分。当您上载着色器程序时,字节码将编译为当前设备的本机着色器语言(例如,OpenGL 或 Direct3D)。运行时会在上载时验证字节码。

程序会在每次调用 Context3D drawTriangles() 方法时运行。顶点程序会为要绘制的三角形列表中的每个顶点执行一次。片段程序会为三角形表面的每个像素执行一次。

着色器程序使用的“变量”称为寄存器。定义了以下寄存器:

名称每个片段程序的数量每个顶点程序的数量目的
属性8顶点着色器输入;读取自使用 Context3D.setVertexBufferAt() 指定的顶点缓冲区。
常量28128着色器输入;使用 Context3D.setProgramConstants() 系列函数设置。
临时88用于计算的临时寄存器,无法从程序外部访问。
输出11着色器输出:在顶点程序中,输出为剪辑空间位置;在片段程序中,输出为颜色。
渐变88在顶点着色器和片段着色器之间传递插补数据。来自顶点程序的渐变寄存器将用作片段程序的输入。根据与三角形顶点的距离插补计算所需的值。
取样器8片段着色器输入;读取自使用 Context3D.setTextureAt() 指定的纹理

顶点程序会接收来自两个源的输入:顶点缓冲区和常量寄存器。使用 Context3D setVertexBufferAt() 方法指定具体顶点属性 寄存器要使用的顶点数据。您最多可以为顶点属性定义 8 个寄存器。顶点属性值读取自三角形列表中每个顶点的顶点缓冲区,并放置在属性寄存器中。使用 Context3D setProgramConstantsFromMatrix()setProgramConstantsFromVector() 方法指定常量 寄存器。常量寄存器为三角形列表中的每个顶点保留相同的值。(您只能在 drawTriangles() 调用之间修改常量值。)

顶点程序负责将三角形顶点投影到剪辑空间(x 和 y 轴上 ±1 之间和 z 轴上 0-1 之间的规范可视区域),并将转换后的坐标放置到输出寄存器中。(通常,将通过一组常量寄存器为着色器提供适当的投影矩阵。)顶点程序还必须将片段程序所需的任何顶点属性或计算值复制到一组名为渐变 寄存器的特殊变量中。在运行片段程序时,将根据当前片段与三角形每个顶点的距离线性插入渐变寄存器提供的值。

片段程序接收来自渐变寄存器和一组独立常量寄存器的值(使用 setProgramConstantsFromMatrix()setProgramConstantsFromVector() 设置)。您也可以从使用取样器 寄存器上载到渲染上下文的纹理读取纹理数据。使用 Context3D setTextureAt() 方法指定具体取样器寄存器要访问的纹理。片段程序负责将其输出寄存器设置为颜色值。

参数

vertexProgram:ByteArray — Vertex 程序的 AGAL 字节码。ByteArray 对象必须使用 little endian 格式。
 
fragmentProgram:ByteArray — Fragment 程序的 AGAL 字节码。ByteArray 对象必须使用 little endian 格式。


引发
TypeError — Null 指针错误:如果 vertexProgramfragmentProgram 为 null。
 
Error — 对象已处置:如果通过调用 dispose() 直接或通过调用 Context3D dispose() 间接处置了 Program3D 对象,或者由于设备丢失导致渲染上下文被处置。
 
ArgumentError — Agal 程序太小:当任一程序代码数组小于 31 字节长度时。这是单指令程序的着色器字节码的大小。
 
ArgumentError — 程序必须是 little endian 格式:如果任一程序字节码数组不是 little endian 格式。
 
Error — 本机着色器编译失败:如果 AGAL 翻译程序的输出不是一个可编译的本机着色器语言程序。只在发行播放器中引发此错误。
 
Error — OpenGL 本机着色器编译失败:如果 AGAL 翻译程序的输出不是可编译的 OpengGL 着色器语言程序,包括编译诊断。只在调试播放器中引发此错误。
 
Error — D3D9 本机着色器编译失败:如果 AGAL 翻译程序的输出不是可编译的 Direct3D 着色器语言程序,包括编译诊断。只在调试播放器中引发此错误。

当 AGAL 字节码验证失败时,会引发下列错误:

 
Error — 不是 AGAL 程序:如果标头的“magic 字节”错误。字节码的第一个字节必须为 0xa0。此错误可能指示字节数组设置为了错误的 endian 顺序。
 
Error — 错误的 AGAL 版本:如果当前 SWF 版本不支持该 AGAL 版本。对于 SWF 版本 13,AGAL 版本必须设置为 1。
 
Error — 错误的 AGAL 程序类型:如果 AGAL 程序类型标识符无效。字节码中的第 3 个字节必须为 0xa1。此错误可能指示字节数组设置为了错误的 endian 顺序。
 
Error — 错误的 AGAL 着色器类型:如果着色器类型代码不是片段或定点(1 或 0)。
 
Error — 无效 AGAL opcode 超出范围:如果在标记流中遇到了无效的 opcode。
 
Error — 无效 AGAL opcode 未实施:如果在标记流中遇到了无效的 opcode。
 
Error — 仅在片段程序中允许的 AGAL opcode:如果在顶点程序的标记流中遇到了仅在片段程序中才允许的 opcode,例如 KIL 或 TEX。
 
Error — 错误的 AGAL 源操作数:如果两个源操作数都是常量寄存器。您必须在着色器程序以外计算结果,并使用单个常量寄存器将其传入。
 
Error — 两个操作数均为间接读取:如果两个操作数均为间接读取。
 
Error — opcode 目标必须全部为零:如果一个带有无目标 opcode(例如,KIL)的标记为目标寄存器设置了非零值。
 
Error — Opcode 目标必须使用遮罩:如果在未使用遮罩时使用了只生成 3 个组件结果的 opcode。
 
Error — 标记过多:如果 AGAL 程序中的标记过多(超过 200 个)。
 
Error — 片段着色器类型:如果片段程序类型(fragmentProgram 参数的第 6 个字节)未设置为 1。
 
Error — 顶点着色器类型:如果顶点程序类型(vertexProgram 参数的第 6 个字节)未设置为 0。
 
Error — 渐变寄存器已读取但未写入:如果片段着色器读取了渐变寄存器,但顶点着色器从未向其中写入。
 
Error — 渐变寄存器部分写入:如果渐变寄存器仅部分写入。必须写入渐变寄存器的所有组件。
 
Error — 片段写入所有组件:如果片段颜色输出仅部分写入。必须写入颜色输出的所有 4 个组件。
 
Error — 顶点写入所有组件:如果顶点剪辑空间输出仅部分写入。必须写入顶点剪辑空间输出的所有组件。
 
Error — 未使用的操作数:如果标记中某个未使用的操作数未全部设置为零。
 
Error — 仅在片段程序中使用取样器寄存器:如果在顶点程序中使用纹理取样器寄存器。
 
Error — 取样器寄存器应为第二个操作数:如果将取样器寄存器用作 AGAL 标记的目标或第一个操作数。
 
Error — 仅允许在顶点程序中使用间接寻址:如果在片段程序中使用间接寻址。
 
Error — 仅在常量寄存器上使用间接寻址:如果在非常量寄存器上使用间接寻址。
 
Error — 间接源类型:如果间接源类型不是属性、常量或临时寄存器。
 
Error — 间接寻址字段必须为零:对于直接寻址,如果不是所有间接寻址字段都为零。
 
Error — 只能在片段程序中读取渐变寄存器:如果在顶点程序中读取渐变寄存器。只能在顶点程序中写入渐变寄存器并只能在片段程序中读取它。
 
Error — 只能在顶点程序中读取属性寄存器:如果在片段程序中读取属性寄存器。只能在顶点程序中读取属性寄存器。
 
Error — 无法读取输出寄存器:如果读取输出(位置或颜色)寄存器。只能写入但不能读取输出寄存器。
 
Error — 读取临时寄存器但未写入过:如果读取临时寄存器但之前未写入过。
 
Error — 读取临时寄存器组件但未写入过:如果读取特定临时寄存器组件但之前未写入过。
 
Error — 不能写入取样器寄存器:如果写入取样器寄存器。只能读取但不能写入取样器寄存器。
 
Error — 渐变寄存器写入:如果在片段程序中写入渐变寄存器。只能在顶点程序中写入渐变寄存器并只能在片段程序中读取它。
 
Error — 无法写入属性寄存器:如果写入属性寄存器。属性寄存器是只读的。
 
Error — 无法写入常量寄存器:如果在着色器程序中写入常量寄存器。
 
Error — 目标 Writemask 为零:如果目标 Writemask 为零。 必须设置输出寄存器的所有组件。
 
Error — AGAL 保留位应为零:如果标记中的任何保留位不为零。这指示在创建字节码时出错(或错误的字节码)。
 
Error — 未知寄存器类型:如果使用了无效寄存器类型索引。
 
Error — 取样器寄存器超出边界:如果使用无效的取样器寄存器索引。
 
Error — 渐变寄存器超出边界:如果使用无效的渐变寄存器索引。
 
Error — 属性寄存器超出边界:如果使用无效的属性寄存器索引。
 
Error — 常量寄存器超出边界:如果使用无效的常量寄存器索引。
 
Error — 输出寄存器超出边界:如果使用无效的输出寄存器索引。
 
Error — 临时寄存器超出边界:如果使用无效的临时寄存器索引。
 
Error — 立方图取样器必须使用锁定模式:如果立方图取样器未将环绕模式设置为锁定。
 
Error — 未知取样器维数:如果样本使用未知取样器维数。(仅支持 2D 和立方体纹理)
 
Error — 未知滤镜模式:如果取样器使用未知滤镜模式。(仅支持最近相邻和线性过滤。)
 
Error — 未知 Mipmap 模式:如果取样器使用未知 mipmap 模式。(仅支持无、最近相邻和线性 mipmap 模式。)
 
Error — 未知环绕模式:如果取样器使用未知环绕模式。(仅支持锁定和重复环绕模式。)
 
Error — 未知特殊标志:如果取样器使用未知特殊标志。
 
Error — 输出颜色不可遮罩:在片段程序中您无法遮罩颜色输出寄存器。必须设置颜色寄存器的所有组件。
 
Error — 第二个操作数必须是取样器寄存器:AGAL 纹理 opcode 必须使用取样器作为第二个源操作数。
 
Error — 不允许间接寻址:在不允许的地方使用间接寻址。
 
Error — 重排必须为标量:重排错误。
 
Error — 无法重排第二个源:重排错误。
 
Error — 再次使用取样器必须使用相同参数:访问相同纹理的所有取样器必须使用相同维数、环绕、滤镜、专用和 mipmap 设置。
 
Error — 3768:后台执行期间不可使用 Stage3D API。

了解详细信息

相关 API 元素





[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。